Bug #61347 [Opn->Csd]: inconsist isset behavior of Arrayobject
| From: | laruence@php.net | Date: | Sun, 11 Mar 2012 08:31:09 +0000 |
| Subject: | Bug #61347 [Opn->Csd]: inconsist isset behavior of Arrayobject | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-168349@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61347&edit=1
ID: 61347
Updated by: laruence@php.net
Reported by: laruence@php.net
Summary: inconsist isset behavior of Arrayobject
-Status: Open
+Status: Closed
Type: Bug
Package: SPL related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2012-03-11 08:27:49] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&revision=324093
Log: Fixed bug #61347 (inconsist isset behavior of Arrayobject)
------------------------------------------------------------------------
[2012-03-11 08:05:01] laruence@php.net
one more :
$a = array('b' => "test");
$b = new ArrayObject($a);
var_dump(isset($b->b));
outputed : bool(false)
should this be true?
------------------------------------------------------------------------
[2012-03-11 05:38:30] laruence@php.net
these codes are weired(spl_array.c:603):
switch(Z_TYPE_P(offset)) {
case IS_STRING:
if (check_empty) {
if (zend_symtable_find(spl_array_get_hash_table(intern, 0
TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &tmp) !=
FAILURE) {
switch (check_empty) {
case 0:
return Z_TYPE_PP(tmp) != IS_NULL;
case 2:
return 1;
default:
return zend_is_true(*tmp);
}
}
return 0;
} else {
return zend_symtable_exists(spl_array_get_hash_table(intern, 0
TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
}
note the switch statement, there is no chance check_empty will be 0, since there
is a if(check_empty) before.
and, I don't see any chance that the check_empty could be 2.
any idea? thanks
------------------------------------------------------------------------
[2012-03-11 05:17:21] laruence@php.net
Description:
------------
isset(arrayobject['index']) act inconsistently with isset(array['index'])
Test script:
---------------
<?php
$a = array('b' => NULL);
var_dump(isset($a['b']));
$b = new ArrayObject($a);
var_dump(isset($b['b']));
Expected result:
----------------
bool(false)
bool(false)
Actual result:
--------------
bool(false)
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61347&edit=1