cvs: ZendEngine2(PHP_5_1) / zend_compile.c /tests bug34358.phpt php-src NEWS
| From: | Dmitry Stogov | Date: | Mon, 03 Oct 2005 08:21:52 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_1) / zend_compile.c /tests bug34358.phpt php-src NEWS | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4187@lists.php.net to get a copy of this message | ||
dmitry Mon Oct 3 04:21:52 2005 EDT
Added files: (Branch: PHP_5_1)
/ZendEngine2/tests bug34358.phpt
Modified files:
/php-src NEWS
/ZendEngine2 zend_compile.c
Log:
Fixed bug #34358 (Fatal error: Cannot re-assign $this)
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2027.2.88&r2=1.2027.2.89&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.88 php-src/NEWS:1.2027.2.89
--- php-src/NEWS:1.2027.2.88 Fri Sep 30 22:01:23 2005
+++ php-src/NEWS Mon Oct 3 04:21:47 2005
@@ -58,6 +58,7 @@
- Fixed bug #34450 (Segfault when calling mysqli_close() in destructor). (Tony)
- Fixed bug #34449 (ext/soap: XSD_ANYXML functionality not exposed). (Dmitry)
- Fixed bug #34420 (Possible crash inside curl_multi_remove_handle()). (Ilia)
+- Fixed bug #34358 (Fatal error: Cannot re-assign $this). (Dmitry)
- Fixed bug #34331 (php crashes when variables_order is empty). (Ilia)
- Fixed bug #34321 (Possible crash in filter code). (Ilia)
- Fixed bug #34311 (unserialize() crashes with chars above 191 dec). (Nuno)
http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.647.2.6&r2=1.647.2.7&ty=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.6 ZendEngine2/zend_compile.c:1.647.2.7
--- ZendEngine2/zend_compile.c:1.647.2.6 Fri Sep 16 13:05:07 2005
+++ ZendEngine2/zend_compile.c Mon Oct 3 04:21:51 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.647.2.6 2005/09/16 17:05:07 tony2001 Exp $ */
+/* $Id: zend_compile.c,v 1.647.2.7 2005/10/03 08:21:51 dmitry Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -567,7 +567,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");
}
}
@@ -597,7 +598,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