[TASK] Cast log message to string 04/21804/5
authorSteffen Müller <typo3@t3node.com>
Tue, 2 Jul 2013 14:50:57 +0000 (16:50 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 2 Jul 2013 15:16:18 +0000 (17:16 +0200)
PSR-3 expects loggers to accept objects as log message and to
cast them to string.

Resolves: #48877
Releases: 6.2
Change-Id: I7558b6db675704d67048914b79a7d8e405bc55d0
Reviewed-on: https://review.typo3.org/21804
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/core/Classes/Log/LogRecord.php

index 280df38..cafcb5a 100644 (file)
@@ -215,11 +215,11 @@ class LogRecord implements \ArrayAccess {
        /**
         * Sets the log message
         *
-        * @param string $message Log message
+        * @param string|object $message Log message. Usually a string, or an object that can be casted to string (implements __toString())
         * @return \TYPO3\CMS\Core\Log\LogRecord
         */
        public function setMessage($message) {
-               $this->message = $message;
+               $this->message = (string)$message;
                return $this;
        }