php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2852 argv/argc inconsistency while running as command-line script
Submitted: 1999-11-28 13:51 UTC Modified: 2000-05-22 20:32 UTC
From: stas at zend dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Beta 3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: stas at zend dot com
New email:
PHP Version: OS:

 

 [1999-11-28 13:51 UTC] stas at zend dot com
Following script (argv.php3):

#!/usr/bin/php -f
<?
printf("argc: %d\nargv1-2:%s-%s\n",$argc,$argv[0],$argv[1]);
?>

when run as ./argv.php3 (without parameters), says:
argc: 1
argv1-2:-

when run as ./argv.php3 abc (1 parameter), says:

argc: 1
argv1-2:abc-

Shouldn't argc be different in two cases? When I do not put -f, script name is included in argv and argc is OK. 

Same effects if I run php -f argv.php3 (like the first case) and php argv.php3 (like the second case).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-22 20:32 UTC] hholzgra at cvs dot php dot net
fixed in latest cvs
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jun 10 13:00:01 2026 UTC