Project

General

Profile

Actions

Bug #50868

closed

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

Added by Christian Finkemeier over 11 years ago. Updated about 6 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 #1

Updated by Gerrit Code Review over 11 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22936

Actions #2

Updated by Gerrit Code Review over 11 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22936

Actions #3

Updated by Gerrit Code Review over 11 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22936

Actions #4

Updated by Wouter Wolters over 11 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #5

Updated by Gerrit Code Review over 11 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/22974

Actions #6

Updated by Gerrit Code Review over 11 years ago

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/22975

Actions #7

Updated by Gerrit Code Review over 11 years ago

Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at https://review.typo3.org/22977

Actions #8

Updated by Gerrit Code Review over 11 years ago

Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at https://review.typo3.org/22978

Actions #9

Updated by Anja Leichsenring over 11 years ago

  • Status changed from Under Review to Resolved
Actions #10

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF