com php-src: Fixed bug #71442 (forward_static_call cras h): NEWS ext/standard/basic_functions.c ext/stand ard/tests/class_object/bug71442.phpt

From: Date: Mon, 25 Jan 2016 04:13:22 +0000
Subject: com php-src: Fixed bug #71442 (forward_static_call cras h): NEWS ext/standard/basic_functions.c ext/stand ard/tests/class_object/bug71442.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90750@lists.php.net to get a copy of this message
Commit: e7f2c5bd6ab047aa8b106bd3376f183fbf117d4d Author: Xinchen Hui <laruence@gmail.com> Mon, 25 Jan 2016 12:13:22 +0800 Parents: b68d525f16f5f966f8ac1b38effcd43a218eef4f Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e7f2c5bd6ab047aa8b106bd3376f183fbf117d4d Log: Fixed bug #71442 (forward_static_call crash) Bugs: https://bugs.php.net/71442 Changed paths: M NEWS M ext/standard/basic_functions.c A ext/standard/tests/class_object/bug71442.phpt Diff: diff --git a/NEWS b/NEWS index 7740472..ec4df90 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP NEWS ?? ??? 2016 PHP 7.0.4 - Core: + . Fixed bug #71442 (forward_static_call crash). (Laruence) . Fixed bug #71441 (Typehinted Generator with return in try/finally crashes). (Bob) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index ad9cf1c...9c657a3 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4835,7 +4835,7 @@ PHP_FUNCTION(forward_static_call) fci.retval = &retval; called_scope = zend_get_called_scope(execute_data); - if (called_scope && + if (called_scope && fci_cache.calling_scope && instanceof_function(called_scope, fci_cache.calling_scope)) { fci_cache.called_scope = called_scope; } @@ -4863,7 +4863,7 @@ PHP_FUNCTION(forward_static_call_array) fci.retval = &retval; called_scope = zend_get_called_scope(execute_data); - if (called_scope && + if (called_scope && fci_cache.calling_scope && instanceof_function(called_scope, fci_cache.calling_scope)) { fci_cache.called_scope = called_scope; } diff --git a/ext/standard/tests/class_object/bug71442.phpt b/ext/standard/tests/class_object/bug71442.phpt new file mode 100644 index 0000000..d6b3d66 --- /dev/null +++ b/ext/standard/tests/class_object/bug71442.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #71442 (forward_static_call crash) +--FILE-- +<?php + +class A +{ + const NAME = 'A'; + public static function test() { + $args = func_get_args(); + echo static::NAME, " ".join(',', $args)." \n"; + } +} + +class B extends A +{ + const NAME = 'B'; + + public static function test() { + echo self::NAME, "\n"; + forward_static_call(array('A', 'test'), 'more', 'args'); + forward_static_call( 'test', 'other', 'args'); + } +} + +B::test('foo'); + +function test() { + $args = func_get_args(); + echo "C ".join(',', $args)." \n"; +} + +?> +--EXPECT-- +B +B more,args +C other,args

« previous php.cvs (#90750) next »