Project

General

Profile

Actions

Bug #50868

closed

stdWrap.numberFormat (tslib_cObj->numberFormat) fills database table sys_log

Added by Christian Finkemeier over 10 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2013-08-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

I am using the stdWrap.numberFormat very often. But it has a negative impact on my databases.

Every time i use the feature a sys_log entry is created:

Core: Error handler (FE): PHP Warning: number_format() expects parameter 1 to be double,
string given in typo3/sysext/cms/tslib/class.tslib_content.php line 4353

PHP expects the first parameter to be float but the main stdWrap function always passes a string value for the $content variable.

It would be very easy to correct this bug by changing one line:

--- typo3/sysext/cms/tslib/class.tslib_content.php
+++ typo3/sysext/cms/tslib/class.tslib_content.php
@@ -4343,12 +4343,12 @@ class tslib_cObj
    function numberFormat($content, $conf) {
        $decimals = isset($conf['decimals.'])
            ? $this->stdWrap($conf['decimals'], $conf['decimals.'])
            : $conf['decimals'];
        $dec_point = isset($conf['dec_point.'])
            ? $this->stdWrap($conf['dec_point'], $conf['dec_point.'])
            : $conf['dec_point'];
        $thousands_sep = isset($conf['thousands_sep.'])
            ? $this->stdWrap($conf['thousands_sep'], $conf['thousands_sep.'])
            : $conf['thousands_sep'];
-        return number_format($content, $decimals, $dec_point, $thousands_sep);
+        return number_format(floatval($content), $decimals, $dec_point, $thousands_sep);
    }

best regards
Christian

Actions

Also available in: Atom PDF