ID: 13813 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: Scripting Engine problem Operating System: Linux 2.2.19 PHP Version: 4.0.6 New Comment:
That's fixed in CVS (and I think upcomming php4.2 also has it): mfischer@devel01:~/tmp$ php -r 'var_dump($argv);' -- /etc/mgetty+sendfax/fax-fail array(2) { [0]=> string(1) "-" [1]=> string(28) "/etc/mgetty+sendfax/fax-fail" } mfischer@devel01:~/tmp$ php -v 4.2.1-dev Previous Comments: ------------------------------------------------------------------------ [2002-03-21 12:19:41] [EMAIL PROTECTED] 4.0.6-7 on Linux 2.4.9-31 I had a similar issue, whlie running the following script: /etc/mgetty+sendfax/fax-fail /var/spool/fax/outgoing/F000052/JOB after some odd behaviour and debugging, I did a print_r($argv) which showed this: Array ( [0] => /etc/mgetty [1] => sendfax/fax-fail [2] => /var/spool/fax/outgoing/F000052/JOB ) apparantly, it also chops out the + signs from the script name itself. ------------------------------------------------------------------------ [2001-10-24 09:45:12] [EMAIL PROTECTED] The '+' character is used as argv separator in the sapi version of PHP4. Therefore, executing this script: <?php // myscript.php echo "first=".$argv[1]."\n"; echo "second=".$argv[2]."\n"; ?> Will produce incoherent results if you put a + in one of the argmuments: # php -q myscript.php "tomatoes and garlic" first=tomatoes and garlic second= # php -q myscript.php "tomatoes+garlic" first=tomatoes second=garlic The bug is located in PHP source file 'sapi/cgi/cgi_main.c', line 643 and above, in function 'int main(int argc, char *argv[])' ... if (script_file) { strcpy(s, script_file); strcat(s, "+"); // ^^^^^^^^ '+' AS SEPARATOR } for (i = ap_php_optind, len = 0; i < argc; i++) { strcat(s, argv[i]); if (i < (argc - 1)) { strcat(s, "+"); // ^^^^^^^^ '+' AS SEPARATOR } } ... A quick-and-easy fix might be to use '\n' as separator, or any other non standard (ascii<32) character. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=13813&edit=1