Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/zend_test/observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]");
}
}

Expand All @@ -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), "");
Expand Down
48 changes: 48 additions & 0 deletions ext/zend_test/tests/observer_fiber_backtrace_crash.phpt
Original file line number Diff line number Diff line change
@@ -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>
Loading