From d2d62b98ebbdb8fa02376c08cec3badb9e48d459 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 22 Dec 2009 15:43:40 +0000 Subject: [PATCH] New method replaceControlCharacters() introduced (very basic implementation), typo fixed --- .../stacker/class_NoStackerException.php | 2 +- .../main/class_BaseFrameworkSystem.php | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/inc/classes/exceptions/stacker/class_NoStackerException.php b/inc/classes/exceptions/stacker/class_NoStackerException.php index f610d271..a8639bc4 100644 --- a/inc/classes/exceptions/stacker/class_NoStackerException.php +++ b/inc/classes/exceptions/stacker/class_NoStackerException.php @@ -31,7 +31,7 @@ class NoStackerException extends FrameworkException { */ public function __construct(array $messageArray, $code) { // Construct message - $message = sprintf("[%s:%d] Stacker %s is not intialized.", + $message = sprintf("[%s:%d] Stacker %s is not initialized.", $messageArray[0]->__toString(), $this->getLine(), $messageArray[1] diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 10b67239..ecca0501 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -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 * -- 2.30.2