Bug #70964 [Opn]: $argc and $argv return wrong value

[email protected] ("jirapat at gmail dot com")
Newsgroups php.standards
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=70964&edit=1

 ID:                 70964
 User updated by:    jirapat at gmail dot com
 Reported by:        jirapat at gmail dot com
 Summary:            $argc and $argv return wrong value
 Status:             Open
 Type:               Bug
 Package:            PHP Language Specification
 Operating System:   Windows 10
 PHP Version:        7.0.0RC7
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2015-11-24 04:07:02] [email protected]

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.