php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50191 $SERVER['argv'] not working as expected
Submitted: 2009-11-16 16:06 UTC Modified: 2009-11-16 19:58 UTC
From: ppass at hotmail dot fr Assigned:
Status: Not a bug Package: URL related
PHP Version: 5.2.11 OS: Windows
Private report: No CVE-ID: None
 [2009-11-16 16:06 UTC] ppass at hotmail dot fr
Description:
------------
I sometimes use URLs with several arguments. The value of some of arguments are urlencoded, so a space will be translated to a + sign.

The problem is that $SERVER['argv'] seems to interpret this + sign by  as a separator.


Reproduce code:
---------------
File: argv_behaviour.php
<?php

Echo "<br/>List of arguments: (".$_SERVER['argv'][0].")";

?>

Expected result:
----------------
When launching argv_behaviour.php?arg1=aa&arg2=b+c&arg3=dd

I expect to see

List of arguments: (arg1=aa&arg2=b+c&arg3=dd)

Actual result:
--------------
but I get 

List of arguments: (arg1=aa&arg2=b)

I get the wrong number of arguments and truncated value for some of them.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-16 16:20 UTC] jani@php.net
This variable is meant for COMMAND line only. 
 [2009-11-16 19:58 UTC] ppass at hotmail dot fr
I don't believe this. 
The manual says:
<< Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string. >>

"When the script is run on the command line" means that COMMAND line is not the only way. Anyway, it is possible to call from PHP.

Still, the problem is not solved.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC