Skip to content

Commit 595d197

Browse files
committed
Merge branch 'xdebug_3_5'
* xdebug_3_5: Fixed issue #2427: Crash when file_link_format setting is wrong
2 parents a3e619a + 18043f0 commit 595d197

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/lib/usefulstuff.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,11 @@ int xdebug_format_file_link(char **filename, const char *error_filename, int err
656656
case '%': /* literal % */
657657
xdebug_str_addc(&fname, '%');
658658
break;
659+
660+
case '\0': /* trailing % */
661+
xdebug_str_addc(&fname, '%');
662+
format--;
663+
break;
659664
}
660665
}
661666
format++;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Test for bug #2427: Crash when file_link_format setting is wrong
3+
--INI--
4+
xdebug.mode=develop
5+
html_errors=On
6+
xdebug.file_link_format=%
7+
--FILE--
8+
<?php
9+
trigger_error('boom');
10+
?>
11+
--EXPECTF--
12+
<br />
13+
<font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
14+
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: boom in <a style='color: black' href='%'>%sbug02427-file-link-format.php</a> on line <i>2</i></th></tr>
15+
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
16+
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
17+
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>%f</td><td bgcolor='#eeeeec' align='right'>%d</td><td bgcolor='#eeeeec'>{main}( )</td><td title='%sbug02427-file-link-format.php' bgcolor='#eeeeec'><a style='color: black' href='%'>...%sbug02427-file-link-format.php<b>:</b>0</a></td></tr>
18+
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>%f</td><td bgcolor='#eeeeec' align='right'>%d</td><td bgcolor='#eeeeec'><a href='http://www.php.net/function.trigger-error.html' target='_new'>trigger_error</a>( <span>$message = </span><span>&#39;boom&#39;</span> )</td><td title='%sbug02427-file-link-format.php' bgcolor='#eeeeec'><a style='color: black' href='%'>...%sbug02427-file-link-format.php<b>:</b>2</a></td></tr>
19+
</table></font>

0 commit comments

Comments
 (0)