Bug #52495 [Opn]: "-d" not parsed when invoked via shebang

From: Date: Fri, 30 Jul 2010 06:47:49 +0000
Subject: Bug #52495 [Opn]: "-d" not parsed when invoked via shebang
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152962@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52495&edit=1

 ID:                 52495
 User updated by:    php-bugs at thequod dot de
 Reported by:        php-bugs at thequod dot de
-Summary:            "-d" parsed inconsistenly when invoked via shebang
+Summary:            "-d" not parsed when invoked via shebang
 Status:             Open
 Type:               Bug
 Package:            PHP options/info functions
 Operating System:   Linux
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

Well, it's actually worse than that: "-d" cannot be used in a shebang
line altogether.

This fails also:
#!/usr/bin/php -n -d date.timezone=Europe/Lisbon

Workaround:
# cat /usr/local/bin/php-noini
/usr/bin/php -n -d Europe/Lisbon "$@"


Previous Comments:
------------------------------------------------------------------------
[2010-07-30 08:30:33] php-bugs at thequod dot de

Description:
------------
The behavior of PHP when used via shebang line in a script is different
from using it directly:

# cat > ~/test.php
#!/usr/bin/php -n -ddate.timezone=Europe/Lisbon
<?php
exit(42);

# chmod +x ~/test.php

# ~/test.php ; echo $?
Usage: php [options] [-f] <file> [--] [args...]
[...]
  -d foo[=bar]     Define INI entry foo with value 'bar'
[...]
0

However, when used directly from the command line, the space after "-d"
appears to be optional:

# php -n -ddate.timezone=Europe/Lisbon -r 'echo date("H:i");'
07:15
# php -n -d date.timezone=Europe/Lisbon -r 'echo date("H:i");'
07:15


Please make the invocation via shebang behave the same in this regard
(accept "-dfoo=bar")



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52495&edit=1


Thread (4 messages)

« previous php.bugs (#152962) next »