[xml] Sax and entity handling

Would it be possible to consider reverting the behavior introduced in 2.7 for the handling of predefined entities?

For the past month I have been trying to come up with a way to fix the xml extension in PHP, which breaks when used with 2.7.x, and have concluded that it is impossible to fix without having some sort of BC breakage or the order of entity processing changed back to its original state.

I understand that predefined entities can not be overriden, but by allowing getEntity to be called first, more flexibility is provided to the application layer. For instance, within getEntity, I am handling the predefined entities by calling xmlGetPredefinedEntity so that the application is still compliant by not overriding any predefined entities. Why this is necessary is that the behavior of the sax parser doesn't follow exactly what libxml does, but rather is mimicking the behavior of expat. There are a number of differences, the biggest being expat's support for a default handler and difference in behavior whether this handler is defined or not.

In order to get all of this to work, within the PHP extension, all of the entity handling is performed within the getEntity call. To avoid having libxml perform any of the handling, the wellFormed flag is set to 0, so within xmlParseReference, the function returns prior to calling any callbacks. Of course this is pretty much a hack, but was necessary to get the desired behavior.

That's pretty much it in a nutshell. I'm open to any other suggestions if going back to the old order is out of the questions.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]