Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0cf500e

Browse files
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-16319: protect fiber backtrace with null filename from crashing (#19973)
2 parents 152dfa8 + 9fc14a9 commit 0cf500e

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

‎ext/zend_test/observer.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static void observer_show_init(zend_function *fbc)
155155
php_printf("%*s<!-- init %s() -->\n", 2 * ZT_G(observer_nesting_depth), "", ZSTR_VAL(fbc->common.function_name));
156156
}
157157
} else {
158-
php_printf("%*s<!-- init '%s' -->\n", 2 * ZT_G(observer_nesting_depth), "", ZSTR_VAL(fbc->op_array.filename));
158+
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]");
159159
}
160160
}
161161

@@ -178,7 +178,7 @@ static void observer_show_init_backtrace(zend_execute_data *execute_data)
178178
php_printf("%*s%s()\n", indent, "", ZSTR_VAL(fbc->common.function_name));
179179
}
180180
} else {
181-
php_printf("%*s{main} %s\n", indent, "", ZSTR_VAL(fbc->op_array.filename));
181+
php_printf("%*s{main} %s\n", indent, "", fbc->op_array.filename ? ZSTR_VAL(fbc->op_array.filename) : "[no active file]");
182182
}
183183
} while ((ex = ex->prev_execute_data) != NULL);
184184
php_printf("%*s-->\n", 2 * ZT_G(observer_nesting_depth), "");
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
--TEST--
2+
GH-16319 (Fiber backtrace with null filename should not crash)
3+
--EXTENSIONS--
4+
zend_test
5+
--INI--
6+
zend_test.observer.enabled=1
7+
zend_test.observer.show_init_backtrace=1
8+
zend_test.observer.show_output=1
9+
zend_test.observer.observe_all=1
10+
zend_test.observer.show_opcode=0
11+
opcache.jit=0
12+
--FILE--
13+
<?php
14+
$fiber = new Fiber(function() {});
15+
$fiber->start();
16+
echo "Test completed without crash\n";
17+
?>
18+
--EXPECTF--
19+
<!-- init %s -->
20+
<!--
21+
{main} %s
22+
-->
23+
<file %s>
24+
<!-- init Fiber::__construct() -->
25+
<!--
26+
Fiber::__construct()
27+
{main} %s
28+
-->
29+
<Fiber::__construct>
30+
</Fiber::__construct>
31+
<!-- init Fiber::start() -->
32+
<!--
33+
Fiber::start()
34+
{main} %s
35+
-->
36+
<Fiber::start>
37+
<!-- init {closure}() -->
38+
<!--
39+
{closure}()
40+
{main} [no active file]
41+
Fiber::start()
42+
{main} %s
43+
-->
44+
<{closure}>
45+
</{closure}>
46+
</Fiber::start>
47+
Test completed without crash
48+
</file %s>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /