Bug #70964 [Csd]: $argc and $argv return wrong value
| From: | ab@php.net | Date: | Wed, 25 Nov 2015 14:21:24 +0000 |
| Subject: | Bug #70964 [Csd]: $argc and $argv return wrong value | ||
| References: | 1 | Groups: | php.standards |
| Request: | Send a blank email to standards-+get-892@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70964&edit=1
ID: 70964
Updated by: ab@php.net
Reported by: jirapat at gmail dot com
Summary: $argc and $argv return wrong value
Status: Closed
Type: Bug
Package: PHP Language Specification
Operating System: Windows 10
PHP Version: 7.0.0RC7
Assigned To: ab
Block user comment: N
Private report: N
New Comment:
I've just tried and couldn't repro the bug just with "php file.php". So
confirmed it's nothing with PHP.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2015-11-24 08:47:06] jirapat at gmail dot com
Sorry after I found my problem now
The problem is from my fault on php.bat in my system path
the bat file is like this
@c:\php\php.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 %10
and windows 10 push the last argument with %10 (maximum variable of bat file is 9)
------------------------------------------------------------------------
[2015-11-24 06:41:22] laruence@php.net
@welting are you able to reproduce this on windows?
------------------------------------------------------------------------
[2015-11-24 05:25:20] jirapat at gmail dot com
I'm not sure are you running the same version and the same value like me ?
to reproduce this just simply run
php.exe arg.php
or may it can be confused by old dll , I just copy all the file after extract it to same directory
of php and run like the command above
------------------------------------------------------------------------
[2015-11-24 04:07:02] laruence@php.net
I can not reproduce this
------------------------------------------------------------------------
[2015-11-24 03:26:51] jirapat at gmail dot com
Description:
------------
in version 7.0.0RC7 it regist wrong $argc and $argv
$argc should be 1 (when no argument even run from php.exe)
$argv[1] should not be set.
in version 5.6.15 is not a problem (may be 7.0 RC3 is doing right too)
D:\dropbox>php -v
PHP 7.0.0RC7 (cli) (built: Nov 11 2015 12:29:58) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
D:\dropbox>php arg.php
var_dump argc
int(2)
var_dump argv
array(2) {
[0]=>
string(7) "arg.php"
[1]=>
string(8) "arg.php0"
}
D:\dropbox>c:\php56\php -v
PHP 5.6.15 (cli) (built: Oct 29 2015 12:40:36)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
D:\dropbox>c:\php56\php arg.php
var_dump argc
int(1)
var_dump argv
array(1) {
[0]=>
string(7) "arg.php"
}
Test script:
---------------
<?
echo "var_dump argc\n";
var_dump($argc);
echo "var_dump argv\n";
var_dump($argv);
?>
Expected result:
----------------
$argc = 1 when no command line variable
$argv[1] should not be set.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70964&edit=1