Allowed debugBackTrace() to not exit (default is to exit)
[core.git] / inc / classes / main / class_BaseFrameworkSystem.php
index fed352a4cfb4e371a635529a59b74540a52cac05..7824280733a44f057ac5c0d746ffd3a06e503da1 100644 (file)
@@ -361,8 +361,15 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                } elseif (is_array($args)) {
                        // Some arguments are there
                        foreach ($args as $arg) {
-                               // Add the type
-                               $argsString .= $this->replaceControlCharacters($arg) . ' (' . gettype($arg);
+                               // Add the value itself if not array. This prevents 'array to string conversion' message
+                               if (is_array($arg)) {
+                                       $argsString .= 'Array';
+                               } else {
+                                       $argsString .= $arg;
+                               }
+
+                               // Add data about the argument
+                               $argsString .= ' (' . gettype($arg);
 
                                if (is_string($arg)) {
                                        // Add length for strings
@@ -726,11 +733,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Checks wether an object equals this object. You should overwrite this
+        * Checks whether an object equals this object. You should overwrite this
         * method to implement own equality checks
         *
         * @param       $objectInstance         An instance of a FrameworkInterface object
-        * @return      $equals                         Wether both objects equals
+        * @return      $equals                         Whether both objects equals
         */
        public function equals (FrameworkInterface $objectInstance) {
                // Now test it
@@ -966,9 +973,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * Outputs a debug backtrace and stops further script execution
         *
         * @param       $message        An optional message to output
+        * @param       $doExit         Whether exit the program (true is default)
         * @return      void
         */
-       public function debugBackTrace ($message = '') {
+       public function debugBackTrace ($message = '', $doExit = true) {
                // Sorry, there is no other way getting this nice backtrace
                if (!empty($message)) {
                        // Output message
@@ -978,14 +986,18 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                print('<pre>');
                debug_print_backtrace();
                print('</pre>');
-               exit();
+
+               // Exit program?
+               if ($doExit === true) {
+                       exit();
+               } // END - if
        }
 
        /**
-        * Outputs a debug message wether to debug instance (should be set!) or dies with or pints the message
+        * Outputs a debug message whether to debug instance (should be set!) or dies with or pints the message
         *
         * @param       $message        Message we shall send out...
-        * @param       $doPrint        Wether we shall print or die here which first is the default
+        * @param       $doPrint        Whether we shall print or die here which first is the default
         * @return      void
         */
        public function debugOutput ($message, $doPrint = true) {
@@ -1311,10 +1323,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Checks wether the given PHP extension is loaded
+        * Checks whether the given PHP extension is loaded
         *
         * @param       $phpExtension   The PHP extension we shall check
-        * @return      $isLoaded       Wether the PHP extension is loaded
+        * @return      $isLoaded       Whether the PHP extension is loaded
         */
        public final function isPhpExtensionLoaded ($phpExtension) {
                // Is it loaded?
@@ -1398,7 +1410,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        /**
         * Idles (sleeps) for given milliseconds
         *
-        * @return      $hasSlept       Wether it goes fine
+        * @return      $hasSlept       Whether it goes fine
         */
        public function idle ($milliSeconds) {
                // Sleep is fine by default
@@ -1899,10 +1911,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Checks wether the given encoded data was encoded with Base64
+        * Checks whether the given encoded data was encoded with Base64
         *
         * @param       $encodedData    Encoded data we shall check
-        * @return      $isBase64               Wether the encoded data is Base64
+        * @return      $isBase64               Whether the encoded data is Base64
         */
        protected function isBase64Encoded ($encodedData) {
                // Determine it
@@ -1938,7 +1950,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @param       $onlyKeys                       Only use these keys for a cache key
         * @return      $cacheKey                       A cache key suitable for lookup/storage purposes
         */
-       protected function getCacheKeyByCriteria (Criteria $criteriaInstance, $onlyKeys = array()) {
+       protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = array()) {
                // Generate it
                $cacheKey = sprintf("%s@%s",
                        $this->__toString(),
@@ -2010,7 +2022,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Assert only if requested
                if ($assertMismatch === true) {
                        // Has the whole value changed?
-                       assert(($assertMismatch === true)('' . $ret . '' != '' . $num . '') && (!is_null($num)));
+                       assert(('' . $ret . '' != '' . $num . '') && (!is_null($num)));
                } // END - if
 
                // Return result