com php-src: Fixed #73969 - Fixed segmentation fault when debug_print_backtrace called: NEWS Zend/zend_buil tin_functions.c tests/basic/bug73969.inc
te sts/basic/bug73969.phpt

From: Date: Sun, 22 Jan 2017 16:11:25 +0000
Subject: com php-src: Fixed #73969 - Fixed segmentation fault when debug_print_backtrace called: NEWS Zend/zend_buil tin_functions.c tests/basic/bug73969.inc
te sts/basic/bug73969.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-96842@lists.php.net to get a copy of this message
Commit: 6f912f7c045ae723d01a24504bf0ae0711fd8a4f Author: andrewnester <andrew.nester.dev@gmail.com> Sun, 22 Jan 2017 18:59:59 +0300 Committer: Joe Watkins <krakjoe@php.net> Sun, 22 Jan 2017 16:11:25 +0000 Parents: 71efe9d8fd0b7486c2943d267c68dcefc6c406b1 Branches: PHP-7..0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6f912f7c045ae723d01a24504bf0ae0711fd8a4f Log: Fixed #73969 - Fixed segmentation fault when debug_print_backtrace called Bugs: https://bugs.php.net/73969 Changed paths: M NEWS M Zend/zend_builtin_functions.c A tests/basic/bug73969.inc A tests/basic/bug73969.phpt Diff: diff --git a/NEWS b/NEWS index d96e7be..ac14eeb 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ PHP NEWS (Laruence) . Fixed bug #73876 (Crash when exporting **= in expansion of assign op). (Sara) + . Fixed bug #73969 (segfault in debug_print_backtrace). (andrewnester) - DTrace: . Fixed bug #73965 (DTrace reported as enabled when disabled). (Remi) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 1887c82..8f77eb4 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions..c @@ -2365,12 +2365,17 @@ ZEND_FUNCTION(debug_print_backtrace) if (call->func) { func = call->func; - function_name = (func->common.scope && - func->common.scope->trait_aliases) ? - ZSTR_VAL(zend_resolve_method_name( - (object ? object->ce : func->common.scope), func)) : - (func->common.function_name ? - ZSTR_VAL(func->common.function_name) : NULL); + zend_string *zend_function_name; + if (func->common.scope && func->common.scope->trait_aliases) { + zend_function_name = zend_resolve_method_name(object ? object->ce : func->common.scope, func); + } else { + zend_function_name = func->common.function_name; + } + if (zend_function_name != NULL) { + function_name = ZSTR_VAL(zend_function_name); + } else { + function_name = NULL; + } } else { func = NULL; function_name = NULL; diff --git a/tests/basic/bug73969.inc b/tests/basic/bug73969.inc new file mode 100644 index 0000000..61b3317 --- /dev/null +++ b/tests/basic/bug73969.inc @@ -0,0 +1,2 @@ +<?php +debug_print_backtrace(); diff --git a/tests/basic/bug73969.phpt b/tests/basic/bug73969.phpt new file mode 100644 index 0000000..11cfecd --- /dev/null +++ b/tests/basic/bug73969.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #73969: segfault on debug_print_backtrace with require() call +--FILE-- +<?php +trait c2 +{ + public static function f1() + { + + } +} + +class c1 +{ + use c2 + { + c2::f1 as f2; + } + + public static function go() + { + return require('bug73969.inc'); + } +} + +c1::go(); +?> +--EXPECTF-- +#0 require() called at [%s:19] +#1 c1::go() called at [%s:23]

« previous php.cvs (#96842) next »