Bug #80719 [NEW]: Iterating afte failed ArrayObject::setIteratorClass() causes Segmentation fault
| From: | notmuqsit at gmail dot com | Date: | Sun, 07 Feb 2021 04:10:47 +0000 |
| Subject: | Bug #80719 [NEW]: Iterating afte failed ArrayObject::setIteratorClass() causes Segmentation fault | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-231968@lists.php.net to get a copy of this message | ||
From: notmuqsit at gmail dot com
Operating system: Ubuntu 20.04.1 LTS (Focal Fossa)
PHP version: 7.4.15
Package: SPL related
Bug Type: Bug
Bug description:Iterating afte failed ArrayObject::setIteratorClass() causes Segmentation fault
Description:
------------
ArrayObject::setIteratorClass() accepts a class of type ArrayIterator as
its only parameter. Supplying a non-ArrayIterator class, (such as
FilterIterator) causes the following error:
Fatal error: ArrayObject::getIterator(): Internal compiler error, Class
is not child of ArrayObject or ArrayIterator in /in/L5USF on line 5
However, foreach-ing the ArrayObject after a failed setIteratorClass()
call as such causes a segmentation fault:
Process exited with code 139.
Test script:
---------------
(https://3v4l.org/L3c7f)
<?php
$array = new ArrayObject();
$array->setIteratorClass(FilterIterator::class);
foreach($array as $_){
}
Expected result:
----------------
Fatal error: ArrayObject::getIterator(): Internal compiler error, Class
is not child of ArrayObject or ArrayIterator in /in/L3c7f on line 5
Actual result:
--------------
Fatal error: ArrayObject::getIterator(): Internal compiler error, Class
is not child of ArrayObject or ArrayIterator in /in/L3c7f on line 5
Process exited with code 139.
--
Edit bug report at https://bugs.php.net/bug.php?id=80719&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80719&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80719&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80719&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80719&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80719&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80719&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80719&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80719&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80719&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80719&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80719&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80719&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80719&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80719&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80719&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80719&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80719&r=mysqlcfg