php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24091 CLI Segfault
Submitted: 2003-06-09 04:33 UTC Modified: 2003-06-15 23:45 UTC
From: devon at sitetronics dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.3.2 OS: RHL 7.3/kern 2.4.21-rc6
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-06-09 04:33 UTC] devon at sitetronics dot com
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-09 04:35 UTC] wez@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

And disable any accelerator, caching and encoding products.
 [2003-06-09 04:46 UTC] devon at sitetronics dot com
Same in 4.3.2
 [2003-06-09 08:36 UTC] sniper@php.net
What might that script contain..? I can not reproduce this with PHP 4.3.3-dev.

 [2003-06-15 23:45 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Feb 05 03:05:48 2023 UTC