[BUGFIX] date expects parameter 2 to be long, string given
authorSimon Schaufelberger <simonschaufi@googlemail.com>
Sat, 15 Oct 2011 09:38:13 +0000 (11:38 +0200)
committerJigal van Hemert <jigal@xs4all.nl>
Tue, 18 Oct 2011 07:28:47 +0000 (09:28 +0200)
Any zero length string value is replaced with the current timestamp.
(Just like the default value for the second parameter of date/gmdate.)

Change-Id: I44d095deb7b511b8b35730f2f031186aeaadb945
Fixes: #30931
Releases: 4.6, 4.5, 4.4
Reviewed-on: http://review.typo3.org/5821
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
Reviewed-by: Björn Pedersen
Reviewed-by: Simon Schaufelberger
Tested-by: Simon Schaufelberger
typo3/sysext/cms/tslib/class.tslib_content.php

index 90afe9e..4f1c6e1 100644 (file)
@@ -2417,11 +2417,13 @@ class tslib_cObj {
         * Will return a formatted date based on configuration given according to PHP date/gmdate properties
         * Will return gmdate when the property GMT returns TRUE
         *
-        * @param       string          Input value undergoing processing in this function.
-        * @param       array           stdWrap properties for date.
-        * @return      string          The processed input value
+        * @param string $content Input value undergoing processing in this function.
+        * @param array $conf stdWrap properties for date.
+        * @return string The processed input value
         */
        public function stdWrap_date($content = '', $conf = array()) {
+                       // check for zero length string to mimic default case of date/gmdate.
+               $content = $content == '' ? $GLOBALS['EXEC_TIME'] : intval($content);
                $content = ($conf['date.']['GMT'] ? gmdate($conf['date'], $content) : date($conf['date'], $content));
                return $content;
        }