summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2013-10-16 18:39:13 +0200
committerNikita Popov <nikic@php.net>2013-10-16 18:39:13 +0200
commitd51553e3992d6c7d2654db6342fa8c0393a85380 (patch)
treec39416632fbca858350c53b33b54e115a9803ad0
parenta2eacd8a2c417027fda4c19e54e2b6af9f1fa90d (diff)
parent865f22162767bcdac60d90b2509751601b65f6ee (diff)
downloadphp-git-d51553e3992d6c7d2654db6342fa8c0393a85380.tar.gz
Merge branch 'PHP-5.5'
-rw-r--r--Zend/tests/bug65911.phpt20
-rw-r--r--Zend/zend_compile.c1
2 files changed, 21 insertions, 0 deletions
diff --git a/Zend/tests/bug65911.phpt b/Zend/tests/bug65911.phpt
new file mode 100644
index 0000000000..b9f37b7bd6
--- /dev/null
+++ b/Zend/tests/bug65911.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #65911 (scope resolution operator - strange behavior with $this)
+--FILE--
+<?php
+class A {}
+
+class B
+{
+ public function go()
+ {
+ $this->foo = 'bar';
+ echo A::$this->foo; // should not output 'bar'
+ }
+}
+
+$obj = new B();
+$obj->go();
+?>
+--EXPECTF--
+Fatal error: Access to undeclared static property: A::$this in %s on line %d
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 3bdacc750d..85536f43b7 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -901,6 +901,7 @@ static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) /* {{{ */
{
if ((opline->opcode == ZEND_FETCH_W) && (opline->op1_type == IS_CONST)
&& (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING)
+ && ((opline->extended_value & ZEND_FETCH_STATIC_MEMBER) != ZEND_FETCH_STATIC_MEMBER)
&& (Z_HASH_P(&CONSTANT(opline->op1.constant)) == THIS_HASHVAL)
&& (Z_STRLEN(CONSTANT(opline->op1.constant)) == (sizeof("this")-1))
&& !memcmp(Z_STRVAL(CONSTANT(opline->op1.constant)), "this", sizeof("this"))) {