|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-10-25 23:04 UTC] mwelinder at gmail dot com
Description:
------------
Chained assignments (a=b=c;) appear to not work in some circumstances.
When sequenced assignments (b=c; a=b;) are used, things work.
Test script:
---------------
<?php
class Test {
var $c = null;
function funcall ()
{
return array(2,3);
}
}
$o = new Test;
// Chain assignment
list ($a,$b) = $o->c = $o->funcall();
print "XXX";
print $a;
print "YYY";
// Separate assignment
$o->c = $o->funcall();
list ($a,$b) = $o->c;
print $a;
print "ZZZ";
?>
Expected result:
----------------
Expected: XXX2YYY2ZZZ
Actual result:
--------------
Actual: XXXYYY2ZZZ
Patchesbug65969-2.patch (last revision 2013-11-27 08:56 UTC by dmitry at zend dot com)bug65969.patch (last revision 2013-11-27 06:32 UTC by laruence@php.net) bug65969.phpt (last revision 2013-11-27 05:39 UTC by laruence@php.net) Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 16:00:01 2025 UTC |
A segfault happens on: - 5.5.5 (only in CLI mode), 5.4-snap and 5.5-snap on Arch64 - 5.5.4 on unknown 64-bit Linux Works fine on 5.3-snap. Backtrace (5.5-snap): #0 0x000000000065db1a in ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER ( execute_data=0x7ffff7f8b1c8) at /home/user0/Desktop/php5.5-201310261630/Zend/zend_vm_execute.h:14781 #1 0x000000000063dbe6 in execute_ex (execute_data=0x7ffff7f8b1c8) at /home/user0/Desktop/php5.5-201310261630/Zend/zend_vm_execute.h:363 #2 0x000000000063dc57 in zend_execute (op_array=0x7ffff7fc2578) at /home/user0/Desktop/php5.5-201310261630/Zend/zend_vm_execute.h:388 #3 0x00000000005f1162 in zend_eval_stringl ( str=0x7ffff7fc1478 "list($a, $b) = $o->c = $o->funcall();\n", str_len=38, retval_ptr=0x0, string_name=0x72bcdb "php shell code") at /home/user0/Desktop/php5.5-201310261630/Zend/zend_execute_API.c:1179 #4 0x0000000000496c5a in readline_shell_run () at /home/user0/Desktop/php5.5-201310261630/ext/readline/readline_cli.c:664 #5 0x00000000006a95af in do_cli (argc=2, argv=0xa39aa0) at /home/user0/Desktop/php5.5-201310261630/sapi/cli/php_cli.c:992 #6 0x00000000006aa597 in main (argc=2, argv=0xa39aa0) at /home/user0/Desktop/php5.5-201310261630/sapi/cli/php_cli.c:1378 Valgrind tells (5.5-snap): Invalid read of size 8 at 0x65DB1A: ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER (zend_vm_execute.h:14781) by 0x63DBE5: execute_ex (zend_vm_execute.h:363) by 0x63DC56: zend_execute (zend_vm_execute.h:388) by 0x5F1161: zend_eval_stringl (zend_execute_API.c:1179) by 0x496C59: readline_shell_run (readline_cli.c:664) by 0x6A95AE: do_cli (php_cli.c:992) by 0x6AA596: main (php_cli.c:1378) Address 0xc6c6eb68bec6c600 is not stack'd, malloc'd or (recently) free'd