summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Watkins <krakjoe@php.net>2017-01-22 16:11:38 +0000
committerJoe Watkins <krakjoe@php.net>2017-01-22 16:11:57 +0000
commit8bda5420648021dd6f92bac45915d6422b636df3 (patch)
treea6afcf7ebdc3a32375a93fbba30ee77c04be0c21
parent4af464a0df91126d25105c75104be3829f2e9cf5 (diff)
parent6f912f7c045ae723d01a24504bf0ae0711fd8a4f (diff)
downloadphp-git-8bda5420648021dd6f92bac45915d6422b636df3.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fixed #73969 - Fixed segmentation fault when debug_print_backtrace called
-rw-r--r--NEWS1
-rw-r--r--Zend/zend_builtin_functions.c17
-rw-r--r--tests/basic/bug73969.inc2
-rw-r--r--tests/basic/bug73969.phpt30
4 files changed, 44 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 7ad8924be0..488e990b72 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ PHP NEWS
. Fixed bug #73876 (Crash when exporting **= in expansion of assign op).
(Sara)
. Fixed bug #73962 (bug with symlink related to cyrillic directory). (Anatol)
+ . 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 596827423e..d6941da778 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -2447,12 +2447,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 0000000000..61b331769c
--- /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 0000000000..11cfecd16b
--- /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]