View Issue Details

IDProjectCategoryView StatusLast Update
0000326Xdebugpublic2007-10-26 14:11
Reporterfrode Assigned Toderick  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionduplicate 
Summary0000326: include() on non-existant file crashes xdebug with a segmentation fault
Description

Using xdebug 2.0.1 installed from PECL (although it identifies itself as 2.0.2-dev?); including a non-existant file causes a segmentation fault.

(This is for PHP 5.2.4 but the bug report dropdown only goes up to 5.2.1)

Additional Information

Script to reproduce:
<?php
include("notfound.php");
?>

Output with regular php 5.2.4:
%php5 -v
PHP 5.2.4 (cli) (built: Aug 31 2007 08:41:24)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Zend Optimizer v3.3.0Beta, Copyright (c) 1998-2007, by Zend Technologies

%php5 xdebug_crasher.php
PHP Warning: include(notfound.php): failed to open stream: No such file or directory in /home/frode/temp/xdebug_crasher.php on line 1

Warning: include(notfound.php): failed to open stream: No such file or directory in /home/frode/temp/xdebug_crasher.php on line 1
PHP Warning: include(): Failed opening 'notfound.php' for inclusion (include_path='.:/devel2/x2www/usr/php-5.2.4/bin') in /home/frode/temp/xdebug_crasher.php on line 1

Warning: include(): Failed opening 'notfound.php' for inclusion (include_path='.:/devel2/x2www/usr/php-5.2.4/bin') in /home/frode/temp/xdebug_crasher.php on line 1

Output with php 5.2.4 + xdebug:
% /devel2/x2www/usr/x2unit/php-current/bin/php -v
PHP 5.2.4 (cli) (built: Sep 3 2007 11:40:11)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Xdebug v2.0.2-dev, Copyright (c) 2002-2007, by Derick Rethans
% /devel2/x2www/usr/x2unit/php-current/bin/php xdebug_crasher.php

Warning: include(notfound.php): failed to open stream: No such file or directory in /home/frode/temp/xdebug_crasher.php on line 1

Call Stack:
0.0003 50732 1. {main}() /home/frode/temp/xdebug_crasher.php:0

Warning: include(): Failed opening 'notfound.php' for inclusion (include_path='.:/devel2/x2www/usr/x2unit/php-5.2.4/bin') in /home/frode/temp/xdebug_crasher.php on line 1

Call Stack:
0.0003 50732 1. {main}() /home/frode/temp/xdebug_crasher.php:0

zsh: segmentation fault /devel2/x2www/usr/x2unit/php-current/bin/php xdebug_crasher.php

GDB backtrace:
% gdb /devel2/x2www/usr/x2unit/php-current/bin/php
GNU gdb 6.4.90-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run xdebug_crasher.php
Starting program: /devel2/x2www/usr/x2unit/php-5.2.4/bin/php xdebug_crasher.php
[Thread debugging using libthread_db enabled]
[New Thread -1219942176 (LWP 28641)]

Warning: include(notfound.php): failed to open stream: No such file or directory in /home/frode/temp/xdebug_crasher.php on line 1

Call Stack:
0.0003 51108 1. {main}() /home/frode/temp/xdebug_crasher.php:0

Warning: include(): Failed opening 'notfound.php' for inclusion (include_path='.:/devel2/x2www/usr/x2unit/php-5.2.4/bin') in /home/frode/temp/xdebug_crasher.php on line 1

Call Stack:
0.0003 51108 1. {main}() /home/frode/temp/xdebug_crasher.php:0

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1219942176 (LWP 28641)]
0xb722b60f in xdebug_compile_file (file_handle=0xbfb434e4, type=2)
at /tmp/pear/cache/xdebug-2.0.1/xdebug.c:2342
2342 op_array->reserved[XG(reserved_offset)] = 0;
(gdb) bt full
#0 0xb722b60f in xdebug_compile_file (file_handle=0xbfb434e4, type=2)
at /tmp/pear/cache/xdebug-2.0.1/xdebug.c:2342
op_array = (zend_op_array ) 0x0
#1 0x0830bc2b in compile_filename (type=2, filename=0xb745d654)
at /devel2/x2www/src/x2unit/php-5.2.4/Zend/zend_language_scanner.c:3465
file_handle = {type = 0 '\0', filename = 0xb745cfb0 "notfound.php", opened_path = 0x0, handle = {
fd = 0, fp = 0x0, stream = {handle = 0x0, reader = 0xb77b34c0 <after_morecore_hook+24>, closer = 0x69,
fteller = 0xb77b34f8 <
after_morecore_hook+80>, interactive = 129}}, free_filename = 0 '\0'}
tmp = {value = {lval = -1216662280, dval = 7.8868721287222057e-314, str = {val = 0xb77b34f8 "",
len = 3}, ht = 0xb77b34f8, obj = {handle = 3078305016, handlers = 0x3}}, refcount = 807415840,
type = 8 '\b', is_ref = 224 'à'}
retval = <value optimized out>
0000002 0x0834bfcc in ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER (execute_data=0xbfb43610)
at /devel2/x2www/src/x2unit/php-5.2.4/Zend/zend_vm_execute.h:2001
file_handle = {type = 88 'X',
filename = 0x8343040 "U\211å\213E\b\213U\f\213H,\205Ét\006\211U\b]ÿá]Ã\220\215´&",
opened_path = 0xbfb43588 "¨5´¿ÿ?4\bÈôa\b`04\bXÔE·XÔE·XÔE·\0206´¿X6´¿(G4\b\0206´¿Ô4{·è5´¿n\"3\bpÕE·,ÔE·$",
handle = {fd = 137486316, fp = 0x831dfec, stream = {handle = 0x831dfec, reader = 0x8674c78,
closer = 0xb745d458, fteller = 0, interactive = -1078708720}}, free_filename = 88 'X'}
opline = (zend_op
) 0xb745d638
new_op_array = <value optimized out>
original_return_value = (zval *) 0xbfb43724
inc_filename = (zval
) 0xb745d654
tmp_inc_filename = {value = {lval = -1078708720, dval = -0.078943774035188818, str = {
val = 0xbfb43610 "8ÖE·À4{·XÔE·@ßq\bß½n·", len = -1078708824}, ht = 0xbfb43610, obj = {
handle = 3216258576, handlers = 0xbfb435a8}}, refcount = 137641983, type = 200 'È', is_ref = 244 'ô'}
failure_retval = <value optimized out>
0000003 0x08344728 in execute (op_array=0xb745d458) at /devel2/x2www/src/x2unit/php-5.2.4/Zend/zend_vm_execute.h:92
execute_data = {opline = 0xb745d638, function_state = {function_symbol_table = 0xb77b34c0,
function = 0xb745d458, reserved = {0x871df40, 0xb76ebddf, 0x0, 0x24}}, fbc = 0x0, op_array = 0xb745d458,
object = 0x0, Ts = 0xbfb435e0, CVs = 0xbfb435d0, original_in_execution = 0 '\0', symbol_table = 0x861f2b0,
prev_execute_data = 0x0, old_error_reporting = 0x0}
0000004 0xb7228f78 in xdebug_execute (op_array=0xb745d458) at /tmp/pear/cache/xdebug-2.0.1/xdebug.c:1509
dummy = (zval *) 0x831e3fa
edata = (zend_execute_data
) 0x0
fse = (function_stack_entry *) 0x871df40

Note that this only happens with include(). It seems that include_once(), require() and require_once() is not affected

TagsNo tags attached.
Operating SystemDebian GNU/Linux 4.0 + Linux 2.6.22.10
PHP Version5.2-dev

Relationships

duplicate of 0000315 closed xdebug crash when including a file that doesn't exist 

Activities

frode

2007-10-26 14:07

reporter   ~0000762

Actually the script to reproduce was:
<?php include("notfound.php"); ?>

(on one line),
in case you're wondering about the line number references in the above output.

derick

2007-10-26 14:11

administrator   ~0000763

And already fixed in CVS - thanks for your report.

Issue History

Date Modified Username Field Change
2007-10-26 14:05 frode New Issue
2007-10-26 14:07 frode Note Added: 0000762
2007-10-26 14:11 derick Status new => resolved
2007-10-26 14:11 derick Resolution open => duplicate
2007-10-26 14:11 derick Relationship added duplicate of 0000315
2007-10-26 14:11 derick Assigned To => derick
2007-10-26 14:11 derick Note Added: 0000763
2016-07-31 12:35 derick Category Debug client (console) => debugclient (debugging tool)
2016-07-31 12:35 derick Category debugclient (debugging tool) => (No Category)