Bug #39287
get_html_translation_table expects at most 2 parameters, 3 given
Status: | Resolved | Start date: | 2012-07-26 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 100% |
|
Category: | - | Spent time: | - | |
Target version: | 4.7.3 | |||
TYPO3 Version: | 4.7 | Is Regression: | No | |
PHP Version: | 5.3 | Sprint Focus: | ||
Complexity: |
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.
Related issues
Associated revisions
[BUGFIX] Compatibility fix for get_html_translation_table()
t3lib_cs::entities_to_utf8() triggers a PHP warning on versions
lower than 5.3.4 because too many parameters were given.
See http://php.net/manual/en/function.get-html-translation-table.php
Change-Id: Ic302f2b8c2902ec8685dfb2d974273071bbbdcb7
Fixes: #39287
Releases: 6.0, 4.7
Reviewed-on: http://review.typo3.org/13504
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
[BUGFIX] Compatibility fix for get_html_translation_table()
t3lib_cs::entities_to_utf8() triggers a PHP warning on versions
lower than 5.3.4 because too many parameters were given.
See http://php.net/manual/en/function.get-html-translation-table.php
Change-Id: I1aa11c98f2418d6dab332676f50a5229b04b895e
Fixes: #39287
Releases: 6.0, 4.7
Reviewed-on: http://review.typo3.org/16949
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
Reviewed-by: Michael Stucki
Tested-by: Michael Stucki
[BUGFIX] Compatibility fix for get_html_translation_table()
t3lib_cs::entities_to_utf8() triggers a PHP warning on versions
lower than 5.3.4 because too many parameters were given.
See http://php.net/manual/en/function.get-html-translation-table.php
Change-Id: Ic302f2b8c2902ec8685dfb2d974273071bbbdcb7
Fixes: #39287
Releases: 6.0, 4.7
Reviewed-on: https://review.typo3.org/17180
Reviewed-by: Michael Stucki
Tested-by: Michael Stucki
History
#1 Updated by Stephan Großberndt about 3 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); } } } }
#2 Updated by Gerrit Code Review almost 3 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
#3 Updated by Gerrit Code Review almost 3 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13504
#4 Updated by Gerrit Code Review almost 3 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13504
#5 Updated by Gerrit Code Review almost 3 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13504
#6 Updated by Gerrit Code Review over 2 years ago
Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13504
#7 Updated by Ernesto Baschny over 2 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...
#8 Updated by Gerrit Code Review over 2 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
#9 Updated by Ernesto Baschny over 2 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.
#10 Updated by Gerrit Code Review over 2 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
#11 Updated by Michael Stucki over 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 5aff2a5776084284fadbc65417c66290a7314b82.
#12 Updated by Oliver Hader over 1 year 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/