Bug #67067 [NEW]: isset() and empty() on NULL value of the ArrayObject child class
From: dmitriy dot trt at gmail dot com
Operating system: Windows 7 x86, Linux
PHP version: 5.4.27
Package: *General Issues
Bug Type: Bug
Bug description:isset() and empty() on NULL value of the ArrayObject child class
Description:
------------
ArrayObject itself and child classes work fine until you override
offsetExists() method, even with a method returning parent's results.
Both isset() and empty() return incorrect results on NULL value set to
the pseudo-array.
Reproducible on PHP 5.4.27, Windows 7 x86.
Test script:
---------------
http://pastebin.com/geNadPSA
Expected result:
----------------
array(2) {
["ArrayObject"]=>
array(2) {
["empty"]=>
bool(true)
["isset"]=>
bool(false)
}
["ArrayObjectOverride"]=>
array(2) {
["empty"]=>
bool(true)
["isset"]=>
bool(false)
}
}
Actual result:
--------------
array(2) {
["ArrayObject"]=>
array(2) {
["empty"]=>
bool(true)
["isset"]=>
bool(false)
}
["ArrayObjectOverride"]=>
array(2) {
["empty"]=>
bool(false)
["isset"]=>
bool(true)
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=67067&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67067&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67067&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67067&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=67067&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=67067&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=67067&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=67067&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=67067&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=67067&r=support
Expected behavior: https://bugs.php.net/fix.php?id=67067&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=67067&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=67067&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=67067&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67067&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=67067&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=67067&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=67067&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=67067&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=67067&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=67067&r=mysqlcfg
Thread (2 messages)
- dmitriy dot trt at gmail dot com