PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Console » Console_Getargs » Bug #7132

Missing value for $_SERVER['SCRIPT_NAME']

Details

Submitted2006-03-16 16:12 UTC
Fromrobmadole at gmail dot com
Assignedscottmattocks
StatusClosed
PackageConsole_Getargs
PHP Version5.1.2
OSFreeBSD 6.0
Roadmaps(Not assigned)

Comments

[2006-03-16 16:12 UTC] robmadole at gmail dot com

Description:
------------
In Console/Getargs.php on line 288 there is a reference to $_SERVER. On my use of this package, the value for $_SERVER['SCRIPT_NAME'] is not set. The getHelp() function returns a help menu with missing information, namely the script name.

From what I understand, $_SERVER can be fairly unreliable from one operating system to another. Would it be a better solution to use argv[0] instead. I would think this information would be much more stable from one OS to another. And since this is a package devoted to the CLI, I would think the use of it would be ok.

Test script:
---------------
if (!isset($_SERVER['SCRIPT_NAME']))
{
echo 'The script name is not set in $_SERVER';
}
else
{
echo 'The script name is set';
}