php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80719 Iterating after failed ArrayObject::setIteratorClass() causes Segmentation fault
Submitted: 2021-02-07 04:10 UTC Modified: 2021-02-11 14:58 UTC
From: notmuqsit at gmail dot com Assigned: nikic (profile)
Status: Closed Package: SPL related
PHP Version: 7.4.15 OS: Ubuntu 20.04.1 LTS (Focal Fossa)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: notmuqsit at gmail dot com
New email:
PHP Version: OS:

 

 [2021-02-07 04:10 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-07 04:11 UTC] notmuqsit at gmail dot com
-Summary: Iterating afte failed ArrayObject::setIteratorClass() causes Segmentation fault +Summary: Iterating after failed ArrayObject::setIteratorClass() causes Segmentation fault
 [2021-02-07 04:11 UTC] notmuqsit at gmail dot com
Fixed typo in Summary (afte -> after)
 [2021-02-11 14:58 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2021-02-11 15:14 UTC] nikic@php.net
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
 [2021-02-11 15:14 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC