Bug #80719 [Asn->Csd]: Iterating after failed ArrayObject::setIteratorClass() causes Segmentation fault

From: Date: Thu, 11 Feb 2021 15:14:22 +0000
Subject: Bug #80719 [Asn->Csd]: Iterating after failed ArrayObject::setIteratorClass() causes Segmentation fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232062@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80719&edit=1 ID: 80719 Updated by: nikic@php.net Reported by: notmuqsit at gmail dot com Summary: Iterating after failed ArrayObject::setIteratorClass() causes Segmentation fault -Status: Assigned +Status: Closed Type: Bug Package: SPL related Operating System: Ubuntu 20.04.1 LTS (Focal Fossa) PHP Version: 7.4.15 Assigned To: nikic Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=c34c5234678a5898c1796983e9ca8faa293f3fe3 Log: Fixed bug #80719 Previous Comments: ------------------------------------------------------------------------ [2021-02-07 04:11:18] notmuqsit at gmail dot com Fixed typo in Summary (afte -> after) ------------------------------------------------------------------------ [2021-02-07 04:10:47] notmuqsit at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=80719&edit=1

« previous php.bugs (#232062) next »