Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of Phalcon\Config::offsetUnset() #820

Merged
merged 5 commits into from Jul 10, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ext/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,11 @@ PHP_METHOD(Phalcon_Config, offsetUnset){
zval *index;

phalcon_fetch_params(0, 1, 0, &index);
#if PHP_VERSION_ID < 50400
Z_OBJ_HANDLER_P(getThis(), unset_property)(getThis(), index TSRMLS_CC);
#else
Z_OBJ_HANDLER_P(getThis(), unset_property)(getThis(), index, 0 TSRMLS_CC);
#endif

RETURN_TRUE;
}
Expand Down
11 changes: 10 additions & 1 deletion unit-tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ public function testConfigMerge()

}


public function testIssue731()
{
// Code path AAA, B, AE, B
Expand Down Expand Up @@ -223,4 +222,14 @@ public function testIssue731()
$a->merge($b);
$this->assertEquals($a->toArray(), $c);
}

public function testIssue732()
{
$a = new Phalcon\Config(array('a' => 0));

$this->assertTrue(isset($a['a']));
unset($a['a']);
$this->assertTrue(!isset($a['a']));
}
}