#48002 [Opn->Fbk]: pcnt_exec() called on php binary with parameters crashes
| From: | lbarnaud@php.net | Date: | Sat, 18 Apr 2009 18:18:29 +0000 |
| Subject: | #48002 [Opn->Fbk]: pcnt_exec() called on php binary with parameters crashes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-135952@lists.php.net to get a copy of this message | ||
ID: 48002
Updated by: lbarnaud@php.net
Reported By: smeves at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: PCNTL related
Operating System: Mac OS 10.5.6
PHP Version: 5.2.9
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
Thanks for your report. Could you please send a backtrace with debug
symbols ?
Previous Comments:
------------------------------------------------------------------------
[2009-04-17 07:03:36] smeves at gmail dot com
Description:
------------
A call to pcntl_exec($path, $args) where $path is the path to the php
binary (ie '/usr/bin/php') causes a segmentation fault if $args
contains
more than one element (the first element in $args is the full path to
the a php source file).
Calling pcntl_exec() directly on a php file with the #!/usr/bin/php
header causes the same problem, and in this case the the only way to
avoid a segmentation fault is if $args is an empty array (in other
words, if *no* parameters are passed to the php script).
A workaround is to call pcntl_exec($path, $args) where $path is
'/bin/sh', and $args is array('-c', 'executablePhp.php param1
param2'). However, if more than 3 params are passed into the
executablePhp file, a segmentation fault occurs.
Reproduce code:
---------------
<?php
//parentProcess.php
echo "Starting inside of ".__FILE__."\n";
$args = array(
dirname(__FILE__).'/childProcess.php',
'myParam'
);
pcntl_exec('/usr/local/bin/php', $args);
echo "Back inside of ".__FILE__."\n"; // should never execute
?>
<?php
//childProcess.php
echo "Now inside of ".__FILE__."\n";
print_r($argv);
?>
Expected result:
----------------
Starting inside of /path/to/parentProcess.php
Now inside of /path/to/childProcess.php
Array
(
[0] => /path/to/childProcess.php
[1] => myParam
)
Actual result:
--------------
Starting inside of /path/to/parentProcess.php
Segmentation fault
// inside my crash log:
Process: php [9209]
Path: /usr/local/bin/php
Identifier: php
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: bash [3413]
Date/Time: 2009-04-17 02:48:06.303 -0400
OS Version: Mac OS X 10.5.6 (9G55)
Report Version: 6
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: 0x000000000000000d, 0x0000000000000000
Crashed Thread: 0
Thread 0 Crashed:
0 ??? 0x0000000100adf1c1 0 +
4306366913
1 ??? 0x0000000100ae076f 0 +
4306372463
2 ??? 0x0000000100ae0a1c 0 +
4306373148
3 ??? 0x0000000100adf04d 0 +
4306366541
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000041 rbx: 0x00007fff5fbfff10 rcx:
0x0000000000000000 rdx: 0x0000000000000014
rdi: 0x0000000100ae2708 rsi: 0x636f6c2f7273752f rbp:
0x00007fff5fbffe50 rsp: 0x00007fff5fbffe50
r8: 0x0000000000000000 r9: 0x0000000000000000 r10:
0x0000000000000000 r11: 0x0000000000000000
r12: 0x0000000000000014 r13: 0x0000000100ae2708 r14:
0x0000000000000015 r15: 0x0000000000000000
rip: 0x0000000100adf1c1 rfl: 0x0000000000010293 cr2:
0x0000000100ae2708
Binary Images:
0x7fff5fc00000 - 0x7fff5fc2e643 dyld 97.1 (???)
<b40847f1ce1ba2ed13837aeccbf19284> /usr/lib/dyld
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48002&edit=1