mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-16319: protect fiber backtrace with null filename from crashing (#19973)
This commit is contained in:
@@ -155,7 +155,7 @@ static void observer_show_init(zend_function *fbc)
|
||||
php_printf("%*s<!-- init %s() -->\n", 2 * ZT_G(observer_nesting_depth), "", ZSTR_VAL(fbc->common.function_name));
|
||||
}
|
||||
} else {
|
||||
php_printf("%*s<!-- init '%s' -->\n", 2 * ZT_G(observer_nesting_depth), "", ZSTR_VAL(fbc->op_array.filename));
|
||||
php_printf("%*s<!-- init '%s' -->\n", 2 * ZT_G(observer_nesting_depth), "", fbc->op_array.filename ? ZSTR_VAL(fbc->op_array.filename) : "[no active file]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ static void observer_show_init_backtrace(zend_execute_data *execute_data)
|
||||
php_printf("%*s%s()\n", indent, "", ZSTR_VAL(fbc->common.function_name));
|
||||
}
|
||||
} else {
|
||||
php_printf("%*s{main} %s\n", indent, "", ZSTR_VAL(fbc->op_array.filename));
|
||||
php_printf("%*s{main} %s\n", indent, "", fbc->op_array.filename ? ZSTR_VAL(fbc->op_array.filename) : "[no active file]");
|
||||
}
|
||||
} while ((ex = ex->prev_execute_data) != NULL);
|
||||
php_printf("%*s-->\n", 2 * ZT_G(observer_nesting_depth), "");
|
||||
|
||||
48
ext/zend_test/tests/observer_fiber_backtrace_crash.phpt
Normal file
48
ext/zend_test/tests/observer_fiber_backtrace_crash.phpt
Normal file
@@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
GH-16319 (Fiber backtrace with null filename should not crash)
|
||||
--EXTENSIONS--
|
||||
zend_test
|
||||
--INI--
|
||||
zend_test.observer.enabled=1
|
||||
zend_test.observer.show_init_backtrace=1
|
||||
zend_test.observer.show_output=1
|
||||
zend_test.observer.observe_all=1
|
||||
zend_test.observer.show_opcode=0
|
||||
opcache.jit=0
|
||||
--FILE--
|
||||
<?php
|
||||
$fiber = new Fiber(function() {});
|
||||
$fiber->start();
|
||||
echo "Test completed without crash\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
<!-- init %s -->
|
||||
<!--
|
||||
{main} %s
|
||||
-->
|
||||
<file %s>
|
||||
<!-- init Fiber::__construct() -->
|
||||
<!--
|
||||
Fiber::__construct()
|
||||
{main} %s
|
||||
-->
|
||||
<Fiber::__construct>
|
||||
</Fiber::__construct>
|
||||
<!-- init Fiber::start() -->
|
||||
<!--
|
||||
Fiber::start()
|
||||
{main} %s
|
||||
-->
|
||||
<Fiber::start>
|
||||
<!-- init {closure}() -->
|
||||
<!--
|
||||
{closure}()
|
||||
{main} [no active file]
|
||||
Fiber::start()
|
||||
{main} %s
|
||||
-->
|
||||
<{closure}>
|
||||
</{closure}>
|
||||
</Fiber::start>
|
||||
Test completed without crash
|
||||
</file %s>
|
||||
Reference in New Issue
Block a user