diff options
author | SVN Migration <svn@php.net> | 2005-10-17 20:26:14 +0000 |
---|---|---|
committer | SVN Migration <svn@php.net> | 2005-10-17 20:26:14 +0000 |
commit | a23f4d06df76f105a4fb914a2a6923f47b2ec655 (patch) | |
tree | e1ffe8b362523a838838e5bd6ec51808c385b65a | |
parent | f133b09907ca4ccbfc4956c9fbf470d8f0c7240c (diff) | |
download | php-git-a23f4d06df76f105a4fb914a2a6923f47b2ec655.tar.gz |
This commit was manufactured by cvs2svn to create tag 'php_5_1_0RC3'.php-5.1.0RC3
-rw-r--r-- | Zend/tests/bug34873.phpt | 27 | ||||
-rw-r--r-- | Zend/zend_compile.c | 6 | ||||
-rw-r--r-- | Zend/zend_language_parser.y | 6 |
3 files changed, 5 insertions, 34 deletions
diff --git a/Zend/tests/bug34873.phpt b/Zend/tests/bug34873.phpt deleted file mode 100644 index d8683c991f..0000000000 --- a/Zend/tests/bug34873.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -bug #34873 (Segmentation Fault on foreach in object) ---FILE-- -<?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']) - var_dump($this->var['value']); - } -} -$myPwa = new Pwa(); -$myPwa->test(); - -echo "Done\n"; -?> ---EXPECT-- -string(7) "myvalue" -Done diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index decfaa7b24..9643e15438 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3636,8 +3636,7 @@ void zend_do_foreach_cont(znode *foreach_token, znode *as_token, znode *value, z } value_node = opline->result; - zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); - if (assign_by_ref) { + if (assign_by_ref) { /* Mark FE_FETCH as IS_VAR as it holds the data directly as a value */ zend_do_assign_ref(NULL, value, &value_node TSRMLS_CC); } else { @@ -3648,8 +3647,7 @@ void zend_do_foreach_cont(znode *foreach_token, znode *as_token, znode *value, z if (key->op_type != IS_UNUSED) { znode key_node; - zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); - opline = &CG(active_op_array)->opcodes[as_token->u.opline_num+1]; + opline = &CG(active_op_array)->opcodes[as_token->u.opline_num+1]; opline->result.op_type = IS_TMP_VAR; opline->result.u.EA.type = 0; opline->result.u.opline_num = get_temporary_variable(CG(active_op_array)); diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index b1fd038096..20523e4c67 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -220,7 +220,7 @@ unticked_statement: foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); } | T_FOREACH '(' expr_without_variable { zend_do_foreach_begin(&$1, &$2, &$3, 0 TSRMLS_CC); } T_AS { zend_do_foreach_fetch(&$1, &$2, &$5 TSRMLS_CC); } - variable foreach_optional_arg ')' { zend_check_writable_variable(&$7); zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); } + w_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); } | T_DECLARE { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); } | ';' /* empty statement */ @@ -338,8 +338,8 @@ foreach_optional_arg: foreach_variable: - variable { zend_check_writable_variable(&$1); $$ = $1; } - | '&' variable { zend_check_writable_variable(&$2); $$ = $2; $$.u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; } + w_variable { $$ = $1; } + | '&' w_variable { $$ = $2; $$.u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; } ; for_statement: |