Answer the question
In order to leave comments, you need to log in
"Floating" XML parsing error?
Such an interesting bug.
When adding/updating/viewing a product in PrestaShop via REST (Web Service), at the stage of parsing the returned XML data, an error occurs with code 76 and the message " Unexpected end tag : p". SimpleXML is used to parse XML. The most interesting thing is that the error is not permanent. If you take this XML, on which the parser "stumbled" and check it in online validators, then the data turns out to be completely correct. And even if you restart adding / updating the product, then there will be no error.At each iteration, up to several dozen such errors may occur (and on different products), or may not occur at all.The line number of the error is always different and indicates the tags generated by the CMS.All text data is in the CDATA structure , control characters are removed from the code with a regular expression..
Actually the question is: how is it possible to implement the localization of a bug?
Answer the question
In order to leave comments, you need to log in
Hello.
Try to take xml on a separate test page and generally do not process it in any way. Just save it somewhere. It must be the same item collected multiple times. This is necessary to accurately determine the validity within a single product. 2) Save several types of xml for several products and also test all of them for validity.
The main thing here is to make sure that you always get valid xml.
If everything is fine there, then go to the parser. Run everything through it, but disable as many of the delete and cleanup features as possible. If everything goes well there, then add one cleanup / remove function or other available functions, gradually localizing the problem.
Don't trust yourself or anyone else.) The truth is in the details (s)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question