#40442 [Opn->Asn]: [PATCH] ArrayObject::offsetExists broke in 5.2.1, works in 5.2.0
| From: | sniper@php.net | Date: | Mon, 02 Apr 2007 21:14:18 +0000 |
| Subject: | #40442 [Opn->Asn]: [PATCH] ArrayObject::offsetExists broke in 5.2.1, works in 5.2.0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-111027@lists.php.net to get a copy of this message | ||
ID: 40442
Updated by: sniper@php.net
-Summary: The patch I use to correct the issue
Reported By: olivier at elma dot fr
-Status: Open
+Status: Assigned
Bug Type: SPL related
Operating System: *
PHP Version: 5.2.1
Assigned To: helly
Previous Comments:
------------------------------------------------------------------------
[2007-04-02 12:08:42] olivier at elma dot fr
AFAIK it does not change anything...
------------------------------------------------------------------------
[2007-03-28 20:16:16] helly@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[2007-03-28 08:48:42] tony2001@php.net
Marcus. any news?
------------------------------------------------------------------------
[2007-02-27 10:10:41] olivier at elma dot fr
Just to add the "quick and dirty" patch I use to correct the issue:
--- php-5.2.1/ext/spl/was.spl_array.c 2007-02-09 12:10:18.000000000
+0100
+++ new.php-5.2.1/ext/spl/spl_array.c 2007-02-09 12:06:33.000000000
+0100
@@ -525,7 +525,7 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z",
&index) == FAILURE) {
return;
}
- RETURN_BOOL(spl_array_has_dimension_ex(0, getThis(), index, 1
TSRMLS_CC));
+ RETURN_BOOL(spl_array_has_dimension_ex(0, getThis(), index, 0
TSRMLS_CC));
} /* }}} */
/* {{{ proto mixed ArrayObject::offsetGet(mixed $index)
------------------------------------------------------------------------
[2007-02-12 09:10:23] olivier at elma dot fr
Description:
------------
With 5.2.0 ArrayObject::offsetExists will return "true" if the
offsetExists whether its value is empty or not.
This feature is not working anymore with 5.2.1 as it checks for the
emptyness of the value too.
Reproduce code:
---------------
<?php
$a = new ArrayObject();
$a->offsetSet('property', 0);
if (!$a->offsetExists('property')) {
echo "does not exist\n";
} else {
echo "ok\n";
}
?>
Expected result:
----------------
ok
Actual result:
--------------
does not exist
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40442&edit=1