diff options
author | Dmitry Stogov <dmitry@zend.com> | 2015-11-30 16:52:57 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2015-11-30 16:52:57 +0300 |
commit | 25c5d185fcece7620f4b1790fd705999757f3b2f (patch) | |
tree | a664df96b9ae4d71ca2bf0e55f3f2cabf2376ee2 | |
parent | 5df6f9f20ee571caf30c005fc2eae5eb780ba002 (diff) | |
download | php-git-25c5d185fcece7620f4b1790fd705999757f3b2f.tar.gz |
Fixed bug #70997 (When using parentClass:: instead of parent::, static context changed)
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | Zend/tests/bug70997.phpt | 26 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 4 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 32 |
4 files changed, 46 insertions, 18 deletions
@@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2015, PHP 7.0.1 - Core: + . Fixed bug #70997 (When using parentClass:: instead of parent::, static + context changed). (Dmitry) . Fixed bug #70970 (Segfault when combining error handler with output buffering). (Laruence) . Fixed bug #70967 (Weird error handling for __toString when Error is diff --git a/Zend/tests/bug70997.phpt b/Zend/tests/bug70997.phpt new file mode 100644 index 0000000000..bdb3377c74 --- /dev/null +++ b/Zend/tests/bug70997.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #70997 (When using parentClass:: instead of parent::, static context changed) +--FILE-- +<?php +class A { + const TEST = false; + + public function test() + { + var_dump(static::TEST); + } +} + +class B extends A { + const TEST = true; + + public function test() + { + A::test(); + } +} + +$b = new B; +$b->test(); +--EXPECT-- +bool(true) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 8fae72b2f6..bc41a0bacf 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3102,8 +3102,8 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSE if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { if (Z_OBJ(EX(This)) && instanceof_function(Z_OBJCE(EX(This)), ce)) { object = Z_OBJ(EX(This)); - } - if (!object) { + ce = object->ce; + } else { if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { /* Allowed for PHP 4 compatibility. */ zend_error( diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 5f02d4357e..74adfe4da0 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -5692,8 +5692,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { if (Z_OBJ(EX(This)) && instanceof_function(Z_OBJCE(EX(This)), ce)) { object = Z_OBJ(EX(This)); - } - if (!object) { + ce = object->ce; + } else { if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { /* Allowed for PHP 4 compatibility. */ zend_error( @@ -7667,8 +7667,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { if (Z_OBJ(EX(This)) && instanceof_function(Z_OBJCE(EX(This)), ce)) { object = Z_OBJ(EX(This)); - } - if (!object) { + ce = object->ce; + } else { if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { /* Allowed for PHP 4 compatibility. */ zend_error( @@ -9410,8 +9410,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { if (Z_OBJ(EX(This)) && instanceof_function(Z_OBJCE(EX(This)), ce)) { object = Z_OBJ(EX(This)); - } - if (!object) { + ce = object->ce; + } else { if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { /* Allowed for PHP 4 compatibility. */ zend_error( @@ -11218,8 +11218,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { if (Z_OBJ(EX(This)) && instanceof_function(Z_OBJCE(EX(This)), ce)) { object = Z_OBJ(EX(This)); - } - if (!object) { + ce = object->ce; + } else { if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { /* Allowed for PHP 4 compatibility. */ zend_error( @@ -17547,8 +17547,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { if (Z_OBJ(EX(This)) && instanceof_function(Z_OBJCE(EX(This)), ce)) { object = Z_OBJ(EX(This)); - } - if (!object) { + ce = object->ce; + } else { if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { /* Allowed for PHP 4 compatibility. */ zend_error( @@ -19175,8 +19175,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { if (Z_OBJ(EX(This)) && instanceof_function(Z_OBJCE(EX(This)), ce)) { object = Z_OBJ(EX(This)); - } - if (!object) { + ce = object->ce; + } else { if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { /* Allowed for PHP 4 compatibility. */ zend_error( @@ -20796,8 +20796,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { if (Z_OBJ(EX(This)) && instanceof_function(Z_OBJCE(EX(This)), ce)) { object = Z_OBJ(EX(This)); - } - if (!object) { + ce = object->ce; + } else { if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { /* Allowed for PHP 4 compatibility. */ zend_error( @@ -22366,8 +22366,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { if (Z_OBJ(EX(This)) && instanceof_function(Z_OBJCE(EX(This)), ce)) { object = Z_OBJ(EX(This)); - } - if (!object) { + ce = object->ce; + } else { if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { /* Allowed for PHP 4 compatibility. */ zend_error( |