Bug #61347 [Com]: inconsist isset behavior of Arrayobject
Edit report at https://bugs.php.net/bug.php?id=61347&edit=1
ID: 61347
Comment by: laruence@php.net
Reported by: laruence@php.net
Summary: inconsist isset behavior of Arrayobject
Status: Open
Type: Bug
Package: SPL related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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
Thread (4 messages)