[BUGFIX] strftime expects parameter 2 to be long, string given
authorSimon Schaufelberger <simonschaufi@googlemail.com>
Tue, 18 Sep 2012 19:44:50 +0000 (21:44 +0200)
committerSteffen Ritter <info@rs-websystems.de>
Fri, 12 Oct 2012 13:14:04 +0000 (15:14 +0200)
Any zero length string value is replaced with the current timestamp.
(Just like the default value for the second parameter of
strtime/gmstrftime.)

Change-Id: I58225b1604607685a3fd4ac4ee50b806c552d326
Fixes: #38717
Releases: 6.0, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/14717
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/cms/tslib/class.tslib_content.php

index df0077a..da9001e 100644 (file)
@@ -2568,6 +2568,8 @@ class tslib_cObj {
         * @return      string          The processed input value
         */
        public function stdWrap_strftime($content = '', $conf = array()) {
+                       // Check for zero length string to mimic default case of strtime/gmstrftime
+               $content = $content == '' ? $GLOBALS['EXEC_TIME'] : intval($content);
                $content = ($conf['strftime.']['GMT'] ? gmstrftime($conf['strftime'], $content) : strftime($conf['strftime'], $content));
                $tmp_charset = $conf['strftime.']['charset'] ? $conf['strftime.']['charset'] : $GLOBALS['TSFE']->localeCharset;
                if ($tmp_charset) {