ID: 43168 Updated by: [EMAIL PROTECTED] Reported By: felipensp at gmail dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5.3CVS-2007-11-01 (snap) New Comment:
You're looping over a variable that references itself, no wonder you get strange results and/or segfaults. Previous Comments: ------------------------------------------------------------------------ [2007-11-01 23:20:45] felipensp at gmail dot com In PHP 5.2.3 key 4 cause too seg. fault. ------------------------------------------------------------------------ [2007-11-01 11:14:43] felipensp at gmail dot com Description: ------------ See the result of code. Reproduce code: --------------- <?php $a = range(1,10); foreach ($a as &$b) { // normal # $a[0] = $a; // keys: 1,2,3 - seg. fault # $a[1] = $a; // odd result $a[4] = $a; //5... - seg. fault } var_dump($a); Actual result: -------------- Keys: - Normal: 0 - Seg. fault: 1,2,3,5... (this isn't a bug, right?) - Odd: 4 array(10) { [0]=> int(139421480) [1]=> int(2) [2]=> int(139421820) [3]=> int(139421252) [4]=> &array(10) { [0]=> int(139421480) [1]=> int(2) [2]=> int(139421820) [3]=> int(139421252) [4]=> &array(10) { [0]=> int(139421480) [1]=> int(2) [2]=> int(139421820) [3]=> int(139421252) [4]=> *RECURSION* [5]=> &int(139421480) [6]=> int(139421752) [7]=> int(139421616) [8]=> NULL [9]=> &int(139421480) } [5]=> &int(139421480) [6]=> int(139421752) [7]=> int(139421616) [8]=> NULL [9]=> &int(139421480) } [5]=> &int(139421480) [6]=> int(139421752) [7]=> int(139421616) [8]=> NULL [9]=> &int(139421480) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43168&edit=1