Bug #22698
closedProblems with xml parser and special chars by using ISO-8859-1 charset
0%
Description
Hi,
on a new server I get the following error message by sending ISO-8859-1 coded FlexForms to Typo3 for saving:
t3lib_error_Exception
PHP Catchable Fatal Error: Argument 2 passed to t3lib_div::array_merge_recursive_overrule() must be an array, string given, called in /home/live/t3lib/class.t3lib_tcemain.php on line 1849 and defined in /home/live/t3lib/class.t3lib_div.php line 1960
Related issue: If I try to get some special chars from the database into a flexform, no data will be displayed.
So I have done a little bit of research and found the solution to just change the charset to utf-8. A difficult thing if the sites exists already with many modules. So I tried to get another solution. And here we are:
I looked into the core and found the line which makes problems:
In the class class.t3lib_div.php there is a function xml2arrayProcess. In there is a line
$parser = xml_parser_create();
For solving this issue I just did the following: Just copied the lines
$match = array();
preg_match('/^[[:space:]]*<\?xml[^>]*encoding[[:space:]]*=[[:space:]]*"([^"]*)"/',substr($string,0,200),$match);
$theCharset = $match[1] ? $match[1] : ($TYPO3_CONF_VARS['BE']['forceCharset'] ? $TYPO3_CONF_VARS['BE']['forceCharset'] : 'iso-8859-1');
over the $parser = line above and changed the line to
$parser = xml_parser_create($theCharset);
Thats it. No more errors and I had not to change the charset of the existing site.
Maybe this helps fixing this issue, there are several posts in forums with the same problem.
Kind regards,
Stephan
(issue imported from #M14459)
Updated by Alexander Opitz over 11 years ago
- Status changed from New to Needs Feedback
- Target version deleted (
0)
The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?
Updated by Alexander Opitz about 11 years ago
- Status changed from Needs Feedback to Closed
- Is Regression set to No
No feedback for over 90 days.