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)