php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #27239 PHP (CLI) argument passing
Submitted: 2004-02-13 07:55 UTC Modified: 2004-02-16 15:08 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: echo15 at delirium dot ch Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.3 OS: *
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: echo15 at delirium dot ch
New email:
PHP Version: OS:

 

 [2004-02-13 07:55 UTC] echo15 at delirium dot ch
Description:
------------
Hi Devs

I guess since 4.3.3 the arguments passed to PHP (CLI) are handled differently. Here's an example:

test.php reads:
<?php print "text is ->".$text."<-\n" ?>

with php 4.3.2:
# php test.php "text=foobar"
->foobar<-

with php 4.3.3:
# php test.php "text=foobar"
-><-

The arguments are now found only in $argv. 

While this makes sense at first, some people use the PHP CLI to do subrequests. Let's assume you have two webservers, one delivering WWW and another one delivering WAP content.

The WAP server is doing a subrequest to the WWW server (using PHP CLI) and piping the output through a conversion script 'html2wml'. In order for this to work, the PHP CLI should hold an option to allow passing the arguments to $_POST or $_GET instead of $argv.

I don't see a way to do this as of now but by adding code to the page on the WWW server ? which is most clumsy as this code is not needed for pages delivered to a WWW user agent.

How about a command line argument like:

-x (--argv-to-request) xerox arguments to $_REQUEST

Many thanks for giving it a thought.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-13 07:58 UTC] echo15 at delirium dot ch
Oops, near the end of the feature request, I wrote:

"... to allow passing the arguments to $_POST or $_GET instead of $argv."

Yet what I ment was:

"... to allow passing the arguments to $_REQUEST instead of $argv."
 [2004-02-13 08:05 UTC] echo15 at delirium dot ch
And... no, creating a real HTTP subrequest to the WWW server in the example above does not always do the trick, specially not if the page is password protected. You don't want to have plain passwords in the PHP pages on the WAP server ? and it's slower than using PHP CLI.
 [2004-02-16 15:08 UTC] helly@php.net
The example you gave relies on register_globals. and cli was experimental in 4.2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 10 19:01:28 2024 UTC