From: devon at sitetronics dot com Operating system: RHL 7.3/kern 2.4.21-rc6 PHP version: 4.3.1 PHP Bug Type: Scripting Engine problem Bug description: CLI Segfault
Goofing around with shell scripting in PHP, I bumped into this problem. I scanned the other segfault bugs, but I didn't find one like this. Additionally, I haven't tried with any nightlies, so sorry, but here we go. When running a script with the CLI binary as so: # php -q < somescript.php I receive a segfault. This should work as PHP should parse stuff from stdin, and this is just a pipe. Copying the script to stdin when calling PHP as #php -q I'm able to run the script successfully. Additionally, I can run the script by doing # php -q somescript.php I'm positive that this is because I have PHP reading its pipe from stdin and then requesting user input from stdin as well. But PHP should die gracefully and not segfault. Oh yeah, here's the really strange backtrace #0 0x081299f8 in zend_parse_arg (arg_num=1, arg=0x402c039c, va=0xbf800834, spec=0xbf800824, quiet=0) at /root/build/php/php-4.3.1/Zend/zend_API.c:436 #1 0x08129df8 in zend_parse_va_args (num_args=2, type_spec=0x81568b6 "ss|br", va=0xbf800834, flags=0) at /root/build/php/php-4.3.1/Zend/zend_API.c:527 #2 0x08129e5b in zend_parse_parameters (num_args=2, type_spec=0x81568b6 "ss|br") at /root/build/php/php-4.3.1/Zend/zend_API.c:554 #3 0x080a9c8e in php_if_fopen (ht=2, return_value=0x81d5884, this_ptr=0x0, return_value_used=1) at /root/build/php/php-4.3.1/ext/standard/file.c:1086 #4 0x4027f922 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #5 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #6 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #7 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #8 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #9 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #10 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #11 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #12 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #13 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #14 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #15 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #16 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #17 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so ........... #11382 0x40285ae9 in _ntime () from /usr/local/ioncube/ioncube_loader_lin_4.3.so #11383 0x08102869 in php_execute_script (primary_file=0xbffffac0) at /root/build/php/php-4.3.1/main/main.c:1573 #11384 0x08143610 in main (argc=2, argv=0xbffffb64) at /root/build/php/php-4.3.1/sapi/cli/php_cli.c:746 #11385 0x401331c4 in __libc_start_main () from /lib/libc.so.6 Aha! But before you say "idiot, go email Nick", here's the backtrace with the loader turned off :P. It just proves that Nick's gotta fix his stuff also. #0 0x081299f8 in zend_parse_arg (arg_num=1, arg=0x824be44, va=0xbf800754, spec=0xbf800744, quiet=0) at /root/build/php/php-4.3.1/Zend/zend_API.c:436 #1 0x08129df8 in zend_parse_va_args (num_args=2, type_spec=0x81568b6 "ss|br", va=0xbf800754, flags=0) at /root/build/php/php-4.3.1/Zend/zend_API.c:527 #2 0x08129e5b in zend_parse_parameters (num_args=2, type_spec=0x81568b6 "ss|br") at /root/build/php/php-4.3.1/Zend/zend_API.c:554 #3 0x080a9c8e in php_if_fopen (ht=2, return_value=0x81d47c4, this_ptr=0x0, return_value_used=1) at /root/build/php/php-4.3.1/ext/standard/file.c:1086 #4 0x0813b09c in execute (op_array=0x81cffd0) at /root/build/php/php-4.3.1/Zend/zend_execute.c:1596 #5 0x0813b25a in execute (op_array=0x81d3e80) at /root/build/php/php-4.3.1/Zend/zend_execute.c:1640 #6 0x0813b25a in execute (op_array=0x81d3e80) at /root/build/php/php-4.3.1/Zend/zend_execute.c:1640 ..................... #3908 0x0813b25a in execute (op_array=0x81d2d98) at /root/build/php/php-4.3.1/Zend/zend_execute.c:1640 #3909 0x0813b25a in execute (op_array=0x81cab7c) at /root/build/php/php-4.3.1/Zend/zend_execute.c:1640 #3910 0x08128cac in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /root/build/php/php-4.3.1/Zend/zend.c:864 #3911 0x08102869 in php_execute_script (primary_file=0xbffffac0) at /root/build/php/php-4.3.1/main/main.c:1573 #3912 0x08143610 in main (argc=2, argv=0xbffffb64) at /root/build/php/php-4.3.1/sapi/cli/php_cli.c:746 #3913 0x401331c4 in __libc_start_main () from /lib/libc.so.6 Ok, that's it. Devon -- Edit bug report at http://bugs.php.net/?id=24091&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=24091&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=24091&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24091&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24091&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24091&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24091&r=support Expected behavior: http://bugs.php.net/fix.php?id=24091&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24091&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24091&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24091&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24091&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24091&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24091&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24091&r=gnused