-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix #75245: Don't set content of elements with only whitespaces #4533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
For reference, a running with all PHP versions: https://3v4l.org/02c8K |
Good news ! Thanks a lot ! |
Which commit caused the original change in behavior? |
I've tried to understand how SXE dumping is supposed to work, but was left thoroughly confused. For example:
Is that supposed to happen, or is this a bug? |
I've been looking at the spec for XML 1.0 and i can not find a reference to how tags after character data inside a tag should be handled. I'm sure it's not valid but how it should be handled by libxml/php i don't know. PHP seems to strip out the invalid data and leave the rest. This is possibly an acceptable solution. However, if you would want the data with the invalid characters you would need to do something like this:
|
Can we get a status update here please ? |
What's needed? |
@eriklundin when I first read this I thought there were open questions, but I see now that you did answer ... |
Merged as 6462c19 Thanks. |
Mixing character data and tags is valid XML ^^ I would expect this example to return something like
or at least something with a similar information content. It seems pretty broken to me that SimpleXML just drops the inner tag entirely in this case. |
Bug #75245
Test code:
var_dump(simplexml_load_string('<test1><test2> </test2><test3></test3></test1>'));
Expected results (PHP 5.4.16)
Results from PHP 7.3.8+:
Results after patch: