Bug #80719 [Opn]: Iterating after failed ArrayObject::setIteratorClass() causes Segmentation fault

From: Date: Sun, 07 Feb 2021 04:11:18 +0000
Subject: Bug #80719 [Opn]: Iterating after failed ArrayObject::setIteratorClass() causes Segmentation fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231969@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 User updated by: notmuqsit at gmail dot com Reported by: notmuqsit at gmail dot com -Summary: Iterating afte failed ArrayObject::setIteratorClass() causes Segmentation fault +Summary: Iterating after failed ArrayObject::setIteratorClass() causes Segmentation fault Status: Open Type: Bug Package: SPL related Operating System: Ubuntu 20.04.1 LTS (Focal Fossa) PHP Version: 7.4.15 Block user comment: N Private report: N New Comment: Fixed typo in Summary (afte -> after) Previous Comments: ------------------------------------------------------------------------ [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 (#231969) next »