Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Getopt.php

function Console_Getopt::readPHPArgv

Safely read the $argv PHP array across different PHP configurations. Will take care on register_globals and register_argc_argv ini directives

Return value

mixed the $argv PHP array or PEAR error if not registered

File

vendor/pear/console_getopt/Console/Getopt.php, line 349

Class

Console_Getopt
Command-line options parsing class.

Code

public static function readPHPArgv() {
    global $argv;
    if (!is_array($argv)) {
        if (!@is_array($_SERVER['argv'])) {
            if (!@is_array($GLOBALS['HTTP_SERVER_VARS']['argv'])) {
                $msg = "Could not read cmd args (register_argc_argv=Off?)";
                return PEAR::raiseError("Console_Getopt: " . $msg);
            }
            return $GLOBALS['HTTP_SERVER_VARS']['argv'];
        }
        return $_SERVER['argv'];
    }
    return $argv;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal