]> git.mxchange.org Git - core.git/commitdiff
Make sure 'argv' and 'argc' are there.
authorRoland Haeder <roland@mxchange.org>
Mon, 14 Dec 2015 20:44:39 +0000 (21:44 +0100)
committerRoland Haeder <roland@mxchange.org>
Mon, 14 Dec 2015 20:44:39 +0000 (21:44 +0100)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/main/classes/request/console/class_ConsoleRequest.php

index c5e070ed01adef8b202987309fdebd02fece899f..f510690ecad2be56c2069b2f8af09e5b81820c1c 100644 (file)
@@ -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'];