note 93046 added to reserved.variables.server
| From: | cupy at email dot cz | Date: | Thu, 20 Aug 2009 15:24:32 +0000 |
| Subject: | note 93046 added to reserved.variables.server | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159711@lists.php.net to get a copy of this message | ||
Tech note:
$_SERVER['argc'] and $_SERVER['argv'][] has some funny behaviour,
used from linux (bash) commandline, when called like
"php ./script_name.php 0x020B"
there is everything correct, but
"./script_name.php 0x020B"
is not correct - "0" is passed instead of "0x020B" as
$_SERVER['argv'][1] - see the script below.
Looks like the parameter is not passed well from bash to PHP.
(but, inspected on the level of bash, 0x020B is understood well as $1)
try this example:
------------->8------------------
cat ./script_name.php
#! /usr/bin/php
if( $_SERVER['argc'] == 2)
{
// funny... we have to do this trick to pass e.g. 0x020B from parameters
// ignore this: "PHP Notice: Undefined offset: 2 in ..."
$EID = $_SERVER['argv'][1] + $_SERVER['argv'][2] +
$_SERVER['argv'][3];
}
else
{ // default
$EID = 0x0210; // PPS failure
}
----
Server IP: 64.71.164.2
Probable Submitter: 88.146.80.162
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.server.php
Edit -- https://master.php.net/note/edit/93046
Del: integrated -- https://master.php.net/note/delete/93046/integrated
Del: useless -- https://master.php.net/note/delete/93046/useless
Del: bad code -- https://master.php.net/note/delete/93046/bad+code
Del: spam -- https://master.php.net/note/delete/93046/spam
Del: non-english -- https://master.php.net/note/delete/93046/non-english
Del: in docs -- https://master.php.net/note/delete/93046/in+docs
Del: other reasons-- https://master.php.net/note/delete/93046
Reject -- https://master.php.net/note/reject/93046
Search -- https://master.php.net/manage/user-notes.php