From: ahmadj at mediatrac dot net
Operating system: CentOS 5
PHP version: 5.2.4
PHP Bug Type: SPL related
Bug description: ArrayObject::offsetUnset() doesn't work properly at PHP 5.24
Description:
------------
At PHP 5.23 ArrayObject::offsetUnset() works as I expected, but at PHP
5.24 it doesn't work as I expected. The array offset doesn't destroy/unset
properly and it still reside in the array.
Reproduce code:
---------------
$ArrayField = array("clip.clip_id", "clip.clip_title",
"clip.clip_published_date", "media.media_name",
"conditional_category.conditional_id",
"conditional_category.conditional_name", "client_category_set.client_cids",
"client_category_set.category_name");
$ArrayGroups = array("clip.clip_published_date",
"client_category_set.category_name", "clip.clip_title", "clip.clip_id");
$collection = new ArrayObject($ArrayField);
for ($iter = $collection->getIterator(); $iter->valid();
$iter->next()) {
if (!in_array($iter->current(), $ArrayGroups)) {
$collection->offsetUnset($iter->key());
}
}
Expected result:
----------------
At PHP 5.22 & 5.23, the $arrayField at offset(3,4,5,6) get unset properly,
but when I try this code at PHP 5.24 the $arrayField at those offsets
didn't get unset as PHP 5.22/5.23 did.
--
Edit bug report at http://bugs.php.net/?id=42527&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42527&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42527&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42527&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42527&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42527&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42527&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42527&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42527&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42527&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42527&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42527&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42527&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42527&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42527&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42527&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42527&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42527&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42527&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42527&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42527&r=mysqlcfg