Bug #39287
closedget_html_translation_table expects at most 2 parameters, 3 given
100%
Description
When converting the encoding of a string an error message is added to the log:
Core: Error handler (FE): PHP Warning: get_html_translation_table() expects at most 2 parameters, 3 given in /xxxxxx/typo3/typo3_src-4.7.2/t3lib/class.t3lib_cs.php line 819
This happens because the encoding 'UTF-8' is given as third parameter, but this parameter has been added with PHP 5.3.4 [http://php.net/manual/en/function.get-html-translation-table.php#refsect1-function.get-html-translation-table-changelog].
The TYPO3 page [https://typo3.org/download/] states 5.3.x as required PHP version.
Since for Debian Squeeze only 5.3.3 is available, please add a workaround for 5.3.x versions older than 5.3.4.
Updated by Stephan Großberndt over 12 years ago
Workaround:
The lines
function entities_to_utf8($str, $alsoStdHtmlEnt = FALSE) { if ($alsoStdHtmlEnt) { $trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_COMPAT, 'UTF-8')); }
have to be replaced with
function entities_to_utf8($str, $alsoStdHtmlEnt = FALSE) { if ($alsoStdHtmlEnt) { if (version_compare(PHP_VERSION, '5.3.4') >= 0) { $trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_COMPAT, 'UTF-8')); } else { $trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_COMPAT)); if (!empty($trans_tbl)) { foreach ($trans_tbl as $key => $entry) { $trans_tbl[$key] = utf8_encode($entry); } } } }
Updated by Gerrit Code Review over 12 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 http://review.typo3.org/13504
Updated by Gerrit Code Review over 12 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13504
Updated by Gerrit Code Review over 12 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13504
Updated by Gerrit Code Review over 12 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13504
Updated by Gerrit Code Review almost 12 years ago
Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13504
Updated by Ernesto Baschny almost 12 years ago
The effect of this bug are warnings like these in the log (since TYPO3 4.7):
Core: Error handler (FE): PHP Warning: array_flip() expects parameter 1 to be array, null given in /.../typo3_src/t3lib/class.t3lib_cs.php line 819
Core: Error handler (FE): PHP Warning: get_html_translation_table() expects at most 2 parameters, 3 given in /.../typo3_src/t3lib/class.t3lib_cs.php line 819
This happens for example when Indexed Search is indexing a page (in the frontend).
Fix solves it (at least in my test 4.7 environment). Will review it...
Updated by Gerrit Code Review almost 12 years ago
Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at http://review.typo3.org/16790
Updated by Ernesto Baschny almost 12 years ago
I reviewed positively the master patch. I just didn't merge it yet because of the 6.0.0 release merge freeze, so I will ask Helmut if it's ok to do it anyway.
I already prepared a 4.7 backported patch (no cherry-picking possible because of different class names) and pushed it to gerrit. Since the code at this place didn't change between the versions (except the class name), I would merge it as "already reviewed and verified in upper version". No side-effects expected.
Updated by Gerrit Code Review almost 12 years ago
Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at http://review.typo3.org/16949
Updated by Michael Stucki almost 12 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 5aff2a5776084284fadbc65417c66290a7314b82.
Updated by Oliver Hader over 10 years ago
- Is Regression set to No
Note: This change has been removed again in TYPO3 CMS 6.2 with bb49c3363910ee9b15b4f29f37b0f5bf83d6a041
I've added a work-around to this abandoned change set in case one is still running PHP 5.3.3: https://review.typo3.org/#/c/29593/
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed