New method replaceControlCharacters() introduced (very basic implementation), typo...
[core.git] / inc / classes / main / class_BaseFrameworkSystem.php
index 10b67239db4697fbe098c0e904462f7f92241f7f..ecca05012742e2f3eff381b42a470bfd0854bea6 100644 (file)
@@ -236,7 +236,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        // Some arguments are there
                        foreach ($args as $arg) {
                                // Add the type
-                               $argsString .= $arg . ' (' . gettype($arg);
+                               $argsString .= $this->replaceControlCharacters($arg) . ' (' . gettype($arg);
 
                                // Add length if type is string
                                if (gettype($arg) == 'string') $argsString .= ', '.strlen($arg);
@@ -731,6 +731,25 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                ));
        }
 
+       /**
+        * Replaces control characters with printable output
+        *
+        * @param       $str    String with control characters
+        * @return      $str    Replaced string
+        */
+       protected function replaceControlCharacters ($str) {
+               // Replace them
+               $str = str_replace(
+                       "\r", '[r]', str_replace(
+                       "\n", '[n]', str_replace(
+                       "\t", '[t]',
+                       $str
+               )));
+
+               // Return it
+               return $str;
+       }
+
        /**
         * Output a partial stub message for the caller method
         *