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: | ||
| Assignee: | - | % Done: | 100% |
|
| Category: | - | |||
| Target version: | 4.7.3 | |||
| TYPO3 Version: | 4.7 | Complexity: | ||
| PHP Version: | 5.3 | |||
| Votes: | 1 (View) |
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
| related to Core - Task #34094: Change fallbacks to iso-8859-1 to utf-8 | Resolved | 2012-02-20 | 2012-02-20 |
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
Updated by Stephan Großberndt 10 months 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 10 months 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 10 months 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 10 months 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 10 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 5aff2a5776084284fadbc65417c66290a7314b82.