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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 15:01:30 2024 UTC