]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/class_BaseFrameworkSystem.php
More debug lines and renamed ->
[core.git] / inc / classes / main / class_BaseFrameworkSystem.php
index 370e2ff0f4baa6de2ebb75aa63686c53bf449234..b3ad65ff8cc163cea7d0c01f00b6e36a4d1ec059 100644 (file)
@@ -5,7 +5,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -1346,7 +1346,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                } // END - if
 
                // Construct the full message
-               $stubMessage = sprintf("[%s:] Partial stub!",
+               $stubMessage = sprintf('[%s:] Partial stub!',
                        $methodName
                );
 
@@ -1377,7 +1377,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Sorry, there is no other way getting this nice backtrace
                if (!empty($message)) {
                        // Output message
-                       printf("Message: %s<br />" . chr(10), $message);
+                       printf('Message: %s<br />' . chr(10), $message);
                } // END - if
 
                print('<pre>');
@@ -1398,8 +1398,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      void
         */
        public function debugOutput ($message, $doPrint = true) {
-               // Get debug instance
-               $debugInstance = $this->getDebugInstance();
+               // Set debug instance to NULL
+               $debugInstance = NULL;
+
+               // Try it:
+               try {
+                       // Get debug instance
+                       $debugInstance = $this->getDebugInstance();
+               } catch (NullPointerException $e) {
+                       // The debug instance is not set (yet)
+               }
 
                // Is the debug instance there?
                if (is_object($debugInstance)) {
@@ -1422,7 +1430,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                                // Print message
                                print($message . chr(10));
                        } else {
-                               // DO NOT REWRITE THIS TO app_die() !!!
+                               /*
+                                * BIG FAT NOTE: Do NEVER rewrite this to app_die(), this will
+                                * cause an endless loop.
+                                */
                                die($message);
                        }
                }
@@ -1625,11 +1636,17 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                $fieldArray = $resultInstance->current();
                //* DEBUG: */ $this->debugOutput($fieldName.':<pre>'.print_r($fieldArray, true).'</pre>');
 
+               // Convert dashes to underscore
+               $fieldName = $this->convertDashesToUnderscores($fieldName);
+
                // Does the field exist?
                if (isset($fieldArray[$fieldName])) {
                        // Get it
                        $fieldValue = $fieldArray[$fieldName];
-               } // END - if
+               } else {
+                       // Missing field entry, may require debugging
+                       $this->debugOutput($this->__toString() . ':fieldname=' . $fieldName . ' not found!');
+               }
 
                // Return it
                return $fieldValue;