Bug #18291: exec() arguments (+suggested solution)
From: php.hc@saustrup.net
Operating system: RedHat Linux 7.3
PHP version: 4.1.2
PHP Bug Type: Program Execution
Bug description: exec() arguments (+suggested solution)
This kept me up all night :-) I needed to pass a textstring to an external
program, and did something like this in PHP:
exec('/usr/bin/binary 1 2 3 "a b c" 4 5 6');
It kept screwing up, and after debugging it I realized that the exec()
function actually called /usr/bin/binary with 9 arguments, and not 7 as I
thought it would. Apparently PHP's exec() just splits up the string where
it finds whitespaces and thinks they're different arguments. I'm not sure
about the proper solution, but it would be awesome with a more "strict"
exec()-like function that could work something like this:
newexec('/usr/bin/binary',array('1','2','3','a b
c','4','5','6'));
That way, there would be NO doubt about the arguments :-)
--
Edit bug report at http://bugs.php.net/?id=18291&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18291&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18291&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18291&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18291&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18291&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18291&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18291&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18291&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18291&r=globals
Thread (10 messages)
- php dot hc at saustrup dot net