php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39017 foreach(($obj = new myClass) as $v); echo $obj; segfaults
Submitted: 2006-10-02 16:26 UTC Modified: 2006-10-03 09:12 UTC
From: colder@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.1.6 OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 + 13 = ?
Subscribe to this entry?

 
 [2006-10-02 16:26 UTC] colder@php.net
Description:
------------
The foreach construct destroys the object, leaving the variable in a strange state.

class A {} foreach(($a = new A) as $v);
var_dump($a); // UNKNOWN:0
echo $a; // segfaults

This was spotted by Zuu on ##php@freenode.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-03 09:12 UTC] dmitry@php.net
Fixed in CVS HEAD and  PHP_5_2.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Aug 21 02:01:27 2019 UTC