Skip to content

Commit e73ec70

Browse files
committed
Return userland line and function if present
1 parent 2e8a7c4 commit e73ec70

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

ext/reflection/php_reflection.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7082,7 +7082,10 @@ ZEND_METHOD(ReflectionFiber, getExecutingLine)
70827082
prev_execute_data = fiber->execute_data->prev_execute_data;
70837083
}
70847084

7085-
if (prev_execute_data->func && ZEND_USER_CODE(prev_execute_data->func->common.type)) {
7085+
while (prev_execute_data && prev_execute_data->func && !ZEND_USER_CODE(prev_execute_data->func->common.type)) {
7086+
prev_execute_data = prev_execute_data->prev_execute_data;
7087+
}
7088+
if (prev_execute_data && prev_execute_data->func && ZEND_USER_CODE(prev_execute_data->func->common.type)) {
70867089
RETURN_LONG(prev_execute_data->opline->lineno);
70877090
}
70887091
RETURN_NULL();
@@ -7103,7 +7106,10 @@ ZEND_METHOD(ReflectionFiber, getExecutingFile)
71037106
prev_execute_data = fiber->execute_data->prev_execute_data;
71047107
}
71057108

7106-
if (prev_execute_data->func && ZEND_USER_CODE(prev_execute_data->func->common.type)) {
7109+
while (prev_execute_data && prev_execute_data->func && !ZEND_USER_CODE(prev_execute_data->func->common.type)) {
7110+
prev_execute_data = prev_execute_data->prev_execute_data;
7111+
}
7112+
if (prev_execute_data && prev_execute_data->func && ZEND_USER_CODE(prev_execute_data->func->common.type)) {
71077113
RETURN_STR_COPY(prev_execute_data->func->op_array.filename);
71087114
}
71097115
RETURN_NULL();

ext/reflection/tests/ReflectionFiber_notrace_2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ var_dump($reflection->getTrace());
1616

1717
?>
1818
--EXPECTF--
19-
NULL
20-
NULL
19+
string(%d) "%sReflectionFiber_notrace_2.php"
20+
int(5)
2121
array(3) {
2222
[0]=>
2323
array(4) {

0 commit comments

Comments
 (0)