From 7039cd4c0f78e18370a87b57101ffbad9189bacf Mon Sep 17 00:00:00 2001 From: Vladimir Kolesnikov Date: Thu, 27 Jun 2013 21:02:01 +0300 Subject: [PATCH 1/4] Possible fix for #732 --- ext/config.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/config.c b/ext/config.c index c19e2b5916e..1d6202ad66f 100755 --- a/ext/config.c +++ b/ext/config.c @@ -265,6 +265,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; } From a65f821ece4a2fc879a018df5f73ea9da44f0382 Mon Sep 17 00:00:00 2001 From: Vladimir Kolesnikov Date: Thu, 27 Jun 2013 21:04:26 +0300 Subject: [PATCH 2/4] Test case for #732 --- unit-tests/ConfigTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/unit-tests/ConfigTest.php b/unit-tests/ConfigTest.php index c597aa33901..769ae7e7ab4 100755 --- a/unit-tests/ConfigTest.php +++ b/unit-tests/ConfigTest.php @@ -185,4 +185,12 @@ public function testConfigMerge() } + public function testIssue732() + { + $a = new Phalcon\Config(array('a' => 0)); + + $this->assertTrue(isset($a['a'])); + unset($a['a']); + $this->assertTrue(!isset($a['a'])); + } } From 82e3496d1c4f99fe04e300191cea548c081f4f98 Mon Sep 17 00:00:00 2001 From: Vladimir Kolesnikov Date: Thu, 27 Jun 2013 21:02:01 +0300 Subject: [PATCH 3/4] Possible fix for #732 --- ext/config.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/config.c b/ext/config.c index 5cb3a9ec044..818d7d08723 100755 --- a/ext/config.c +++ b/ext/config.c @@ -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; } From 809297df9628b8e06e8542c06785b77312128acc Mon Sep 17 00:00:00 2001 From: Vladimir Kolesnikov Date: Thu, 27 Jun 2013 21:04:26 +0300 Subject: [PATCH 4/4] Test case for #732 --- unit-tests/ConfigTest.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/unit-tests/ConfigTest.php b/unit-tests/ConfigTest.php index 3244df4da9a..825b4e97278 100644 --- a/unit-tests/ConfigTest.php +++ b/unit-tests/ConfigTest.php @@ -185,7 +185,6 @@ public function testConfigMerge() } - public function testIssue731() { // Code path AAA, B, AE, B @@ -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'])); + } } +