|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-07-28 13:01 UTC] svn@php.net
[2009-07-28 13:01 UTC] dmitry@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 14 17:00:01 2025 UTC |
Description: ------------ When using @list( $b ) = $a; on PHP 6, it seems that a new opcode is inserted that frees a temp variable set from $a (see the "Actual result" section below) and thus segfaults when using $a later. When I set breakpoints on all lines that contains "SWITCH_FREE" in Zend_execute.c, it's the one at line 1170 in function zend_do_free() that is called. Reproduce code: --------------- <?php $a = array( "c" ); @list( $b ) = $a; var_dump( $a ); I also used vld to get the opcodes produced by the laguage parser. Expected result: ---------------- array(1) { [0]=> string(1) "c" } Analyse with vld: $ PHP_5_3/sapi/cli/php -dvld.active=1 ~/test.php Branch analysis from position: 0 Return found filename: /Users/alexandre/test.php function name: (null) number of ops: 11 compiled vars: !0 = $a line # op fetch ext return operands ------------------------------------------------------------------------------- 2 0 INIT_ARRAY ~0 'c' 1 ASSIGN !0, ~0 3 2 BEGIN_SILENCE ~2 3 FETCH_R local $4 'a' 4 FETCH_DIM_R $5 $4, 0 5 FETCH_W local $3 'b' 6 ASSIGN $3, $5 7 END_SILENCE ~2 4 8 SEND_VAR !0 9 DO_FCALL 1 'var_dump' 5 10 RETURN 1 Actual result: -------------- Segmentation fault. Analyse with vld: $ PHP_6/sapi/cli/php -dvld.active=1 ~/test.php Branch analysis from position: 0 Return found filename: /Users/alexandre/test.php function name: (null) number of ops: 12 compiled vars: !0 = $a line # op fetch ext return operands ------------------------------------------------------------------------------- 2 0 INIT_ARRAY ~0 c 1 ASSIGN !0, ~0 3 2 BEGIN_SILENCE ~2 3 FETCH_R local $4 a 4 FETCH_DIM_TMP_VAR $5 $4, 0 5 FETCH_W local $3 b 6 ASSIGN $3, $5 7 END_SILENCE ~2 8 SWITCH_FREE $4 4 9 SEND_VAR !0 10 DO_FCALL 1 var_dump 5 11 RETURN 1 You can see the new opcode "SWITCH_FREE" at position 8.