Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Prevent DocumentFragment from causing internal PHP error by using append()#454

Merged
g105b merged 5 commits intomasterfrom
453-append-child
Apr 25, 2024
Merged

Prevent DocumentFragment from causing internal PHP error by using append()#454
g105b merged 5 commits intomasterfrom
453-append-child

Conversation

@g105b
Copy link
Member

@g105b g105b commented Apr 25, 2024

This is some weird libxml behaviour. I'm going to put in an upstream bug fix at some point, but one of the purposes of this library is to patch this kind of weird behaviour. All tests passing now.

Closes #453

@g105b
Copy link
Member Author

g105b commented Apr 25, 2024

PHPUnit is failing because it's trying to run PHPUnit 11 which requires PHP >= 8.2, but that's not what it says in the composer.lock (or even componser.json).

I will need to upgrade the actions runner as described here: php-actions/phpunit#54

@g105b g105b merged commit e2460c3 into master Apr 25, 2024
@g105b g105b deleted the 453-append-child branch April 25, 2024 16:31
ndossche added a commit to ndossche/php-src that referenced this pull request May 11, 2024
@ndossche
Copy link

ndossche commented May 11, 2024

@g105b PHP core maintainer here. I fixed this here: php/php-src#14206
It was already fixed on the PHP 8.4 development branch because I rewrote the entire ParentNode implementation when implementing opt-in DOM spec-compliance. So I just backported that fix.
Please just submit or ping us when you encounter something like this, otherwise stuff like that never gets fixed or fixed only after a long time. To give an idea: patching this only took 15 minutes from reading this PR until submitting my PR, so even if you just have code it's often easy to fix these issues. It's just that we have to be aware of them in order to be able to fix them.

@g105b
Copy link
Member Author

g105b commented May 11, 2024

@nielsdos hey, thank you for your message. I will submit an upstream issue whenever something like this comes up, but I've never felt confident to do it. I see now that PHP has an issue tracker on Github, so I guess it's just as simple as opening an issue there? That's a lot LOT easier than before, when it was on bugs.php.net.

Thanks for the fix, I'll test it and see if I can remove more of the workarounds in this library.

@ndossche
Copy link

Yep it's just a matter of opening a GH issue. It doesn't even have to be much, just code is enough.
It's worth noting that for PHP 8.4 I have introduced new classes that fix a lot of crap in the DOM extension, full story in the RFC.

ndossche added a commit to php/php-src that referenced this pull request May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DocumentFragment append() vs appendChild()

2 participants