From:             smeves at gmail dot com
Operating system: Mac OS 10.5.6
PHP version:      5.2.9
PHP Bug Type:     Reproducible crash
Bug description:  pcnt_exec() called on php binary with parameters causes 
segmentation fault

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 bug report at http://bugs.php.net/?id=48002&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48002&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48002&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48002&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48002&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48002&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48002&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48002&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48002&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48002&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48002&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48002&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48002&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48002&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48002&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48002&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48002&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48002&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48002&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48002&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48002&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48002&r=mysqlcfg

Reply via email to