Skip to content

Commit

Permalink
Merge branch 'PHP-7.1'
Browse files Browse the repository at this point in the history
* PHP-7.1:
  Fixed #73969 - Fixed segmentation fault when debug_print_backtrace called
  • Loading branch information
krakjoe committed Jan 22, 2017
2 parents ab2489f + 8bda542 commit 8782e84
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 6 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ PHP NEWS
bugs #53838, #61655, #66173, #70925, #72254, etc. (Andrea)
. Raised minimum supported Windows versions to Windows 7/Server 2008 R2.
(Anatol)
. Fixed bug #73969 (segfault in debug_print_backtrace). (andrewnester)

- BCMath:
. Fixed bug #46564 (bcmod truncates fractionals). (liborm85)
Expand Down
17 changes: 11 additions & 6 deletions Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2466,12 +2466,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;
Expand Down
2 changes: 2 additions & 0 deletions tests/basic/bug73969.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
debug_print_backtrace();
30 changes: 30 additions & 0 deletions tests/basic/bug73969.phpt
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit 8782e84

Please sign in to comment.