|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-10-18 14:45 UTC] tony2001@php.net
[2005-10-18 15:32 UTC] steemann at globalpark dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Apr 16 07:00:02 2026 UTC |
Description: ------------ When assigning class variables to the results of a foreach loop and using the variables inside the loop, I am getting a segfault in 5.1RC3. The problem occurs for class variables only. When doing the same with local variables, it does not crash. It also does not crash if the $this->vars["one"] is not used inside the foreach loop. If the foreach loop is used without setting the key for the result it also won't crash, e.g.: foreach $foo as $this->vars["two"] instead of foreach $foo as $this->vars["one"]=>$this->vars["two"] won't crash. I know code like this should never be written but Smarty actually does a lot of stuff like this so it won't work with 5.1.0RC3. Reproduce code: --------------- class x { function run() { $foo=array("0","1"); foreach ($foo as $this->vars["one"]=>$this->vars["two"]) var_dump($this->vars["one"]); } } $x=new x; $x->run(); Expected result: ---------------- in PHP 5.1.0b3: int(0) int(1) Actual result: -------------- in PHP 5.1.0RC3: int(0) NULL Speicherzugriffsfehler (segmentation fault)