diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | Zend/tests/bug65911.phpt | 20 | ||||
-rw-r--r-- | Zend/zend_compile.c | 1 |
3 files changed, 25 insertions, 0 deletions
@@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2013, PHP 5.5.6 +- Core: + . Fixed bug #65911 (scope resolution operator - strange behavior with $this). + (Bob Weinand) + 17 Oct 2013, PHP 5.5.5 - Core: 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 9008f23369..60b9e3e653 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -908,6 +908,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"))) { |