Skip to content

Commit 91908bc

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Fix function/file mixup in backtrace printing
2 parents cbcfd86 + 6fd13d0 commit 91908bc

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

Zend/tests/bug63762.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ string(36) "#0 [internal function]: ()
3939

4040
Array of array of NULL values:
4141

42-
Warning: Function name is not a string in %s on line %d
42+
Warning: File name is not a string in %s on line %d
4343

4444
Warning: Value for class is not a string in %s on line %d
4545

@@ -48,5 +48,5 @@ Warning: Value for type is not a string in %s on line %d
4848
Warning: Value for function is not a string in %s on line %d
4949

5050
Warning: args element is not an array in %s on line %d
51-
string(60) "#0 [unknown function][unknown][unknown][unknown]()
51+
string(58) "#0 [unknown file]: [unknown][unknown][unknown]()
5252
#1 {main}"

Zend/zend_exceptions.c

+3-6
Original file line numberDiff line numberDiff line change
@@ -550,20 +550,17 @@ static void _build_trace_string(smart_str *str, HashTable *ht, uint32_t num) /*
550550
file = zend_hash_find_ex(ht, ZSTR_KNOWN(ZEND_STR_FILE), 1);
551551
if (file) {
552552
if (Z_TYPE_P(file) != IS_STRING) {
553-
zend_error(E_WARNING, "Function name is not a string");
554-
smart_str_appends(str, "[unknown function]");
553+
zend_error(E_WARNING, "File name is not a string");
554+
smart_str_appends(str, "[unknown file]: ");
555555
} else{
556-
zend_long line;
556+
zend_long line = 0;
557557
tmp = zend_hash_find_ex(ht, ZSTR_KNOWN(ZEND_STR_LINE), 1);
558558
if (tmp) {
559559
if (Z_TYPE_P(tmp) == IS_LONG) {
560560
line = Z_LVAL_P(tmp);
561561
} else {
562562
zend_error(E_WARNING, "Line is not an int");
563-
line = 0;
564563
}
565-
} else {
566-
line = 0;
567564
}
568565
smart_str_append(str, Z_STR_P(file));
569566
smart_str_appendc(str, '(');

0 commit comments

Comments
 (0)