From:             antleclercq at online dot fr
Operating system: Ubuntu (breezy)
PHP version:      5CVS-2005-10-14 (CVS)
PHP Bug Type:     Arrays related
Bug description:  Segmentation Fault on foreach in object (used by smarty)

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:
--------------
[EMAIL PROTECTED]:/home/web/sandbox.local/html $ php pwa.php
myvalue*** glibc detected *** double free or corruption (fasttop):
0x085149c8 ***
Aborted


-- 
Edit bug report at http://bugs.php.net/?id=34873&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34873&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34873&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34873&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34873&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34873&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34873&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34873&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34873&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34873&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34873&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34873&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34873&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34873&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34873&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34873&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34873&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34873&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34873&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34873&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34873&r=mysqlcfg

Reply via email to