Skip to content

Commit b3bc3c9

Browse files
committed
Merge branch 'xdebug_3_5'
* xdebug_3_5: Fixed issue #2429: Crash when trace_output_name setting is wrong
2 parents 595d197 + 2b5ab61 commit b3bc3c9

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

src/lib/usefulstuff.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,11 @@ int xdebug_format_output_filename(char **filename, char *format, char *script_na
622622
case '%': /* literal % */
623623
xdebug_str_addc(&fname, '%');
624624
break;
625+
626+
case '\0': /* trailing % */
627+
xdebug_str_addc(&fname, '%');
628+
format--;
629+
break;
625630
}
626631
}
627632
format++;
@@ -719,6 +724,11 @@ int xdebug_format_filename(char **formatted_name, const char *default_fmt, zend_
719724
case '%': /* literal % */
720725
xdebug_str_addc(&fname, '%');
721726
break;
727+
728+
case '\0': /* trailing % */
729+
xdebug_str_addc(&fname, '%');
730+
format--;
731+
break;
722732
}
723733
}
724734
format++;

tests/tracing/bug02429.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Test for bug #2429: Crash when trace_output_name setting is wrong
3+
--SKIPIF--
4+
<?php
5+
require __DIR__ . '/../utils.inc';
6+
?>
7+
--INI--
8+
xdebug.mode=trace,develop
9+
xdebug.start_with_request=yes
10+
xdebug.trace_output_name=trace.%
11+
xdebug.use_compression=0
12+
log_errors=0
13+
--FILE--
14+
<?php
15+
$tfn = xdebug_get_tracefile_name();
16+
17+
echo $tfn, "\n";
18+
19+
@unlink($tfn);
20+
?>
21+
--EXPECTF--
22+
%strace.%.xt

0 commit comments

Comments
 (0)