php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19444 argv is parsed differently when script is run via shebang vs run via php -f
Submitted: 2002-09-16 19:44 UTC Modified: 2002-09-17 00:11 UTC
From: yoglets at hotmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.2.3 OS: RedHat 7.3
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: yoglets at hotmail dot com
New email:
PHP Version: OS:

 

 [2002-09-16 19:44 UTC] yoglets at hotmail dot com
Given the script:

<? print_r($_SERVER['argv']); ?>

When run via a shebang within the file:

% test.php --a=1 --b=2 --c=3
Array
(
    [0] => ./test.php
    [1] => --a=1
    [2] => --b=2
    [3] => --c=3
)

Ok, that's good. Now, running the same script by calling the PHP binary directly:

% php -f test.php --a=1 --b=2 --c=3
Array
(
    [0] => test.php
    [1] => --b=2
    [2] => --c=3
)

Hey, where's my --a=1? I get these same results with 4.2.2 CGI, 4.2.3 CGI, and 4.2.3 CLI.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-16 19:49 UTC] yoglets at hotmail dot com
Doh, I'm an idiot.

% php -f test.php -- --a=1 --b=2 --c=3

Duh. Nevermind. :(
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 20:00:02 2026 UTC