php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29382 crash by invalid Iterator returned from ArrayObject::getIterator()
Submitted: 2004-07-26 01:32 UTC Modified: 2004-07-26 19:13 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: su1d at phpclub dot net Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 5CVS-2004-07-26 (dev) OS: Win32
Private report: No CVE-ID: None
 [2004-07-26 01:32 UTC] su1d at phpclub dot net
Description:
------------
Please, check the code.

P.S. When $this is returned instead of "null" you do get the correct error message, but PHP still crashes.

P.P.S. What do we have Traversable interface for?


Reproduce code:
---------------
<?php

class ArrayObj extends ArrayObject {
	function getIterator() { return $this; }
}

foreach(new ArrayObj(array(123)) as $idx => $line) {
	echo "$idx: $line\n";
}

?>

Expected result:
----------------
Warning: Objects returned by ArrayObj::getIterator() must be traversable or implement interface Iterator in ... on line 7

Actual result:
--------------
*SILENT CRASH*


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-26 19:13 UTC] stas@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Aug 15 20:01:27 2024 UTC