|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-04-18 18:18 UTC] lbarnaud@php.net
[2009-04-19 22:54 UTC] smeves at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 18:00:01 2025 UTC |
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