bad exec parse in nested foreach loop
| From: | Julie Tsai | Date: | Mon, 18 Jun 2001 21:46:52 +0000 |
| Subject: | bad exec parse in nested foreach loop | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-54279@lists.php.net to get a copy of this message | ||
Hi,
I posted this on phpbuilders forum last week and didn't get a peep, so please let me know if
more info or clarification would help.... This involves exec parsing and the foreach function in
PHP4.
I'm encountering a problem with the parsing of an exec string within a foreach loop (itself
nested in an if loop). The string executes correctly outside of the foreach loop, but within the
foreach mangles the arg syntax and returns error code 127.
The exec string within the foreach loop parses correctly up until it enounters the arguments to my
shell script. There it sees 0 or 1 arguments passed to the shell script, triggering the
"Usage: " message.
The exec string invokes the shell script via /bin/bash -c and looks like this:
exec("bin/putenv SOME_STRING /bin/bash -c \"bin/suexec $login \\\$SOME_STRING
my/shell/script $arg1 $arg2 $arg3 \" <<:eof\n".$somestring."\n:eof\n",
$output, $return);
For context, the foreach loop correctly expands and interprets variable and array assignments.
Regards,
Julie
--
Julie Tsai
415 864 0861 (h)
415 990 5271 (cel)