Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 2018

General Questions/New to Joomla! 5.x • Re: Install error Unexpected token '<', " "... is not valid JSON

$
0
0
Thanks, that does point to the problem. As I didn't need them at this point, I only added placeholder files for access.xml and config.xml with no content other than an XML header. It seems that is not acceptable.

I did look for the temporary install directory, but it was deleted before I could see it.

But why ever can't Joomla be more civilised and use proper error handling? Replacing line 256 in libraries/src/Installer/InstallerHelper.php with the following code would make all the difference:

Code:

            libxml_use_internal_errors(true);            $xml = simplexml_load_file($file);            if ($xml === false) {                $errors = libxml_get_errors();                foreach ($errors as $error) {                    Log::add(sprintf("SimpleXML error %d in %s", $error->code, basename($file)), Log::ERROR, 'jerror');                    break;                }                libxml_clear_errors();            }
It is hardly a huge amount of extra code, and it results in the installer coming up with an error message "SimpleXML error 4 in config.xml". That is a huge improvement over "Unexpected token '<', " "... is not valid JSON".

It could be further improved by utilising $error->message. But that needs extra work because the format of the message can't be used directly as it needs some escaping. I haven't spent the extra time required to work out the details. And I'd be satisfied with the simple version that does at least point directly to the problem.

Statistics: Posted by counterpoint — Tue Mar 11, 2025 9:46 am



Viewing all articles
Browse latest Browse all 2018

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>