Project

General

Profile

Actions

Bug #30931

closed

date() expects parameter 2 to be long, string given in class.tslib_content.php

Added by Simon Schaufelberger over 12 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2011-10-14
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.6
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I have the following typoscript (part of a sql string)

20 = TEXT
20.date = U
20.noTrimWrap = | AND date > ||

and i get the following warning message:

Warning: date() expects parameter 2 to be long, string given in /typo3/sysext/cms/tslib/class.tslib_content.php on line 2529

content should NEVER be a string by default here, it as written in the php docs:

string gmdate ( string $format [, int $timestamp = time() ] )

it shold be an int.

public function stdWrap_date($content = '', $conf = array()) {
    $content = ($conf['date.']['GMT'] ? gmdate($conf['date'], $content) : date($conf['date'], $content));
    return $content;
}

for me the code should be something like:

public function stdWrap_date($content = '', $conf = array()) {
    if ($content !== '') {
        $content = ($conf['date.']['GMT'] ? gmdate($conf['date'], $content) : date($conf['date'], $content));
    } else {
        $content = ($conf['date.']['GMT'] ? gmdate($conf['date']) : date($conf['date']));
    }
    return $content;
}

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #38717: strftime() expects parameter 2 to be long, string givenClosedJigal van Hemert2012-07-06

Actions
Has duplicate TYPO3 Core - Bug #24276: PHP Warning may occur in backend UI with recent PHP versionClosed2010-12-02

Actions
Actions

Also available in: Atom PDF