cvs: ZendEngine2 / zend_compile.c /tests bug34358.phpt
| From: | Dmitry Stogov | Date: | Mon, 03 Oct 2005 08:21:21 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c /tests bug34358.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4186@lists.php.net to get a copy of this message | ||
dmitry Mon Oct 3 04:21:21 2005 EDT
Added files:
/ZendEngine2/tests bug34358.phpt
Modified files:
/ZendEngine2 zend_compile.c
Log:
Fixed bug #34358 (Fatal error: Cannot re-assign $this)
http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.664&r2=1.665&ty=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.664 ZendEngine2/zend_compile.c:1.665
--- ZendEngine2/zend_compile.c:1.664 Tue Sep 27 03:58:59 2005
+++ ZendEngine2/zend_compile.c Mon Oct 3 04:21:15 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.664 2005/09/27 07:58:59 dmitry Exp $ */
+/* $Id: zend_compile.c,v 1.665 2005/10/03 08:21:15 dmitry Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -596,7 +596,8 @@
*result = last_op->result;
return;
} else {
- if (opline_is_fetch_this(last_op TSRMLS_CC)) {
+ if (variable->op_type == IS_VAR &&
+ opline_is_fetch_this(last_op TSRMLS_CC)) {
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
}
}
@@ -626,7 +627,8 @@
if (last_op_number > 0) {
zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1];
- if (opline_is_fetch_this(last_op TSRMLS_CC)) {
+ if (lvar->op_type == IS_VAR &&
+ opline_is_fetch_this(last_op TSRMLS_CC)) {
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
}
}
http://cvs.php.net/co.php/ZendEngine2/tests/bug34358.phpt?r=1.1&p=1
Index: ZendEngine2/tests/bug34358.phpt
+++ ZendEngine2/tests/bug34358.phpt
--TEST--
Bug #34358 (Fatal error: Cannot re-assign $this(again))
--FILE--
<?php
class foo {
function bar() {
$ref = &$this;
}
}
$x = new foo();
$x->bar();
echo "ok\n";
?>
--EXPECT--
ok