com php-src: Fixed bug #70997 (When using parentClass:: instead of parent::, static context changed): NEWS Zend/tests/bug70997.phpt Zend/zend_vm_def.h
Zend/zend_vm_execute.h

From: Date: Mon, 30 Nov 2015 13:52:57 +0000
Subject: com php-src: Fixed bug #70997 (When using parentClass:: instead of parent::, static context changed): NEWS Zend/tests/bug70997.phpt Zend/zend_vm_def.h
Zend/zend_vm_execute.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90059@lists.php.net to get a copy of this message
Commit: 25c5d185fcece7620f4b1790fd705999757f3b2f Author: Dmitry Stogov <dmitry@zend.com> Mon, 30 Nov 2015 16:52:57 +0300 Parents: 5df6f9f20ee571caf30c005fc2eae5eb780ba002 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=25c5d185fcece7620f4b1790fd705999757f3b2f Log: Fixed bug #70997 (When using parentClass:: instead of parent::, static context changed) Bugs: https://bugs.php.net/70997 Changed paths: M NEWS A Zend/tests/bug70997.phpt M Zend/zend_vm_def.h M Zend/zend_vm_execute.h Diff: diff --git a/NEWS b/NEWS index c5aa1f3..e74a351 100644 --- a/NEWS +++ b/NEWS @@ -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 0000000..bdb3377 --- /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 8fae72b..bc41a0b 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 5f02d43..74adfe4 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(

« previous php.cvs (#90059) next »