#18566 [Com]: comand line argument parsing with +
| From: | holliwell at gmx dot net | Date: | Tue, 13 Aug 2002 12:01:46 +0000 |
| Subject: | #18566 [Com]: comand line argument parsing with + | ||
| References: | 1 | Groups: | php.bugs php.doc |
| Request: | Send a blank email to php-bugs+get-16598@lists.php.net to get a copy of this message | ||
ID: 18566
Comment by: holliwell@gmx.net
Reported By: goba@php.net
Status: Open
Bug Type: Documentation problem
Operating System: Windows
PHP Version: 4.2.1
New Comment:
with cgi-version(4.2.1, win2k):
test.php a b c
array(4) {
[0]=>
string(8) "test.php"
[1]=>
string(1) "a"
[2]=>
string(1) "b"
[3]=>
string(1) "c"
}
php test.php a+b+c
array(4) {
[0]=>
string(8) "test.php"
[1]=>
string(1) "a"
[2]=>
string(1) "b"
[3]=>
string(1) "c"
}
php test.php a=b=c
array(2) {
[0]=>
string(8) "test.php"
[1]=>
string(5) "a=b=c"
}
php test.php a;b;c
array(2) {
[0]=>
string(8) "test.php"
[1]=>
string(5) "a;b;c"
}
Only a+b+c seems to bahave "strange".
with cli-version(4.2.1,win2k):
php-cli test.php a b c
array(4) {
[0]=>
string(8) "test.php"
[1]=>
string(1) "a"
[2]=>
string(1) "b"
[3]=>
string(1) "c"
}
php-cli test.php a+b+c
array(2) {
[0]=>
string(8) "test.php"
[1]=>
string(5) "a+b+c"
}
php-cli test.php a=b=c
array(2) {
[0]=>
string(8) "test.php"
[1]=>
string(5) "a=b=c"
}
php-cli test.php a;b;c
array(2) {
[0]=>
string(8) "test.php"
[1]=>
string(5) "a;b;c"
)
The same results for cgi and cli version in 4.2.2 on win.
Only a+b+c seems to be strange with the cgi.
Friedhelm
Previous Comments:
------------------------------------------------------------------------
[2002-08-13 07:26:47] edink@php.net
This was one of the reasons CLI was created in the first place - to get
rid of all CGI specific (mis)features.
This issue should probably be mentioned in the command line chapter.
------------------------------------------------------------------------
[2002-08-13 07:21:20] goba@php.net
I tested this with the CGI one, probably it's not a problem with the
CLI.
------------------------------------------------------------------------
[2002-08-13 07:17:43] sander@php.net
Is this still valid with the CLI? Or are you talking about the CGI
executable?
(Can't reproduce it with the CLI on Linux)
------------------------------------------------------------------------
[2002-07-25 11:41:21] goba@php.net
The same effect is reproduceable with:
php test.php a=b=c
php test.php a;b;c
Goba
------------------------------------------------------------------------
[2002-07-25 11:35:56] goba@php.net
I have tries the following script (test.php):
<?php var_dump($argv); ?>
With:
php test.php a b c
and the results are:
array(4) {
[0]=>
string(8) "test.php"
[1]=>
string(1) "a"
[2]=>
string(1) "b"
[3]=>
string(1) "c"
}
What was new to me, is that
php test.php a+b+c
produces the same ;) So if this is intentional,
then it should be documented at least ;)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18566&edit=1