-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOMChildNode replaceWith()
double-free error when replacing elements not separated by any whitespace
#9142
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
Labels
Comments
I can not reproduce it on my centos server but I detect memory leak. |
I could reproduce it locally, here is a bt:
Here is another example which shows the same error:
|
NathanFreeman
added a commit
to NathanFreeman/php-src
that referenced
this issue
Jul 27, 2022
@bakerkretzmar @hwde @cmb69 @beberlei |
@NathanFreeman thanks! where is the PR? |
@bakerkretzmar |
Works for me. |
nielsdos
added a commit
to nielsdos/php-src
that referenced
this issue
May 22, 2023
…ception with replaceWith This replaces the implementation of before and after with one following the spec very strictly, instead of trying to figure out the state we're in by looking at the pointers. Also relaxes the condition on text node copying to prevent working on a stale node pointer.
nielsdos
added a commit
that referenced
this issue
May 25, 2023
… segfaults with replaceWith This replaces the implementation of before and after with one following the spec very strictly, instead of trying to figure out the state we're in by looking at the pointers. Also relaxes the condition on text node copying to prevent working on a stale node pointer. Closes GH-11299.
nielsdos
added a commit
that referenced
this issue
May 25, 2023
nielsdos
added a commit
that referenced
this issue
May 25, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Two XML/HTML elements that are immediately following each other, without any space in between them, cause a 'double free' error if you try to call
replaceWith()
on them.From 3v4l.org (note that the first element is successfully replaced):
Locally (macOS, inside a PHPUnit test, also exits with code 134):
Expected (both
<var>
s replaced and no error):Note:
<var>
elements are separated by a line break or space.<span>
,<p>
).https://3v4l.org/Y2vJc
PHP Version
8.0 and 8.1
Operating System
Whatever 3v4l.org is using, and macOS
The text was updated successfully, but these errors were encountered: