#34873 [Opn->Asn]: Segmentation Fault on foreach in object (used by smarty)
| From: | tony2001@php.net | Date: | Fri, 14 Oct 2005 19:44:26 +0000 |
| Subject: | #34873 [Opn->Asn]: Segmentation Fault on foreach in object (used by smarty) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-86607@lists.php.net to get a copy of this message | ||
ID: 34873
Updated by: tony2001@php.net
Reported By: antleclercq at online dot fr
-Status: Open
+Status: Assigned
-Bug Type: Arrays related
+Bug Type: Scripting Engine problem
Operating System: Ubuntu (breezy)
PHP Version: 5CVS-2005-10-14 (CVS)
-Assigned To:
+Assigned To: dmitry
New Comment:
Dmitry, this patch breaks it:
http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.647.2.7&r2=1.647.2.8&ty=u
Please, take a look at it.
Previous Comments:
------------------------------------------------------------------------
[2005-10-14 17:18:20] antleclercq at online dot fr
Description:
------------
Hello,
I'm running:
- PHP 5.1RC2 CVS200510141230
I've got a nice segfault with that simple piece of code. The problem is
that the code style showed below is used by Smarty (in the compile
system)...
That problem has been reproduced on several systems.
Thanks for your help,
Antoine
Reproduce code:
---------------
<?php
class pwa {
public $var;
function __construct() {
$this->var = array();
}
function test () {
$cont = array();
$cont["mykey"] = "myvalue";
foreach ($cont as $this->var['key'] => $this->var['value'])
echo $this->var['value'];
}
}
$myPwa = new Pwa();
$myPwa->test();
?>
Expected result:
----------------
This code should display:
myvalue
and continue its execution.
Actual result:
--------------
antoine@DaT:/home/web/sandbox.local/html $ php pwa.php
myvalue*** glibc detected *** double free or corruption (fasttop):
0x085149c8 ***
Aborted
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34873&edit=1