From: Roland Haeder Date: Mon, 14 Dec 2015 20:44:39 +0000 (+0100) Subject: Make sure 'argv' and 'argc' are there. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4c803841b20a37b343eac7b97e10d9ce67b9b94c;p=core.git Make sure 'argv' and 'argc' are there. Signed-off-by: Roland Häder --- diff --git a/inc/main/classes/request/console/class_ConsoleRequest.php b/inc/main/classes/request/console/class_ConsoleRequest.php index c5e070ed..f510690e 100644 --- a/inc/main/classes/request/console/class_ConsoleRequest.php +++ b/inc/main/classes/request/console/class_ConsoleRequest.php @@ -35,17 +35,17 @@ class ConsoleRequest extends BaseRequest implements Requestable { /** * Creates an instance of this class and prepares it a little * - * @return $httpInstance An instance of this class + * @return $consoleInstance An instance of this class */ public static final function createConsoleRequest () { // Create an instance - $httpInstance = new ConsoleRequest(); + $consoleInstance = new ConsoleRequest(); // Prepare the console request data for usage - $httpInstance->prepareRequestData(); + $consoleInstance->prepareRequestData(); // Return the prepared instance - return $httpInstance; + return $consoleInstance; } /** @@ -54,6 +54,12 @@ class ConsoleRequest extends BaseRequest implements Requestable { * @return void */ public function prepareRequestData () { + // 'argv' and 'argc' should be there + if ((!isset($_SERVER['argv'])) || (!isset($_SERVER['argc']))) { + // Maybe not right PHP mode? (needs CLI?) + trigger_error(sprintf('[%s:%d]: argv/argc not set: %s', __METHOD__, __LINE__, print_r($_SERVER, TRUE)), E_USER_ERROR); + } // END - if + // Get the "request data" from the command-line argument list $args = $_SERVER['argv'];