Wrong "syntax error" for XML in PHP7.3 HEREDOC block Follow Maxim Created April 12, 2019 19:57 This screenshot explains the problem: So the parser "thinks" that those indentation spaces are part of the document, which is wrong.
Is this a working code (with indent)?
In fact, I just tried a similar construction and got the following from interpreter:
PHP Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : XML declaration allowed only at the start of the document in ...
Yes, this is working code. Just tried it with SimpleXMLElement and it works correctly. If I add more spaces to the first line, then I get the same exception (which is corrent behavior). But with equal indentation level it works great.
Could you please attach a sample code file that works for you?
Doing something like
doesn't reproduce the behavior you're getting for us, unfortunately.