History log of /PHP-8.3/ext/dom/document.c (Results 1 – 25 of 277)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# edc13091 29-May-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix build


# 88ff32a2 29-May-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-14343: Memory leak in xml and dom (#14347)

If there is no root, the namespace cannot be attached to it,
so we have to attach it to the old list.

This isn't a problem in "

Fix GH-14343: Memory leak in xml and dom (#14347)

If there is no root, the namespace cannot be attached to it,
so we have to attach it to the old list.

This isn't a problem in "new DOM" because namespaces are managed in a
separate structure there.

show more ...


# 8e8d5ce2 22-Dec-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix crash in adoptNode with attribute references

I forgot to also update the document reference of attributes, so when
there is no document reference anymore from a variable, but still a

Fix crash in adoptNode with attribute references

I forgot to also update the document reference of attributes, so when
there is no document reference anymore from a variable, but still an
attribute, this can crash. Fix it by also updating the document
references for attributes.

Closes GH-13002.

show more ...


# e658f805 06-Dec-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-12870: Creating an xmlns attribute results in a DOMException

There were multiple things here since forever, see the GH thread [1]
for discussion.

There were already many

Fix GH-12870: Creating an xmlns attribute results in a DOMException

There were multiple things here since forever, see the GH thread [1]
for discussion.

There were already many fixes to this function previously, and as a
consequence of one of those fixes this started throwing exceptions for a
correct use-case. It turns out that even when reverting to the previous
behaviour there are still bugs. Just fix all of them while we have the
chance.

[1] https://github.com/php/php-src/issues/12870

Closes GH-12888.

show more ...


# 8a95e616 17-Nov-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-12702: libxml2 2.12.0 issue building from src

Fixes GH-12702.

Co-authored-by: nono303 <github@nono303.net>


# 900f0cab 24-Oct-2023 icy17 <1061499390@qq.com>

Fix null pointer dereferences in case of allocation failure

Closes GH-12506.


# d7de0cec 11-Oct-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix registerNodeClass with abstract class crashing

This always results in a segfault when trying to instantiate, so this never
worked. At least throw an error instead of segfaulting to p

Fix registerNodeClass with abstract class crashing

This always results in a segfault when trying to instantiate, so this never
worked. At least throw an error instead of segfaulting to prevent developers
from being confused.

Closes GH-12420.

show more ...


# eebc528c 01-Oct-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix broken cache invalidation with deallocated and reallocated document node

The original caching implementation had an oversight in combination with
the new lifetime management in DOM f

Fix broken cache invalidation with deallocated and reallocated document node

The original caching implementation had an oversight in combination with
the new lifetime management in DOM for 8.3.
The modification counter is stored on the document object itself, but as
that can get deallocated when all references disappear, stale cache data
can be used. Normally this isn't a problem, unless getElementsByTagName is
called not on the document but on a child node. Fix it by moving caching
data into the ref object, which will outlive all nodes from a document
even if the document object disappears.

Closes GH-12338.

show more ...


# 20ac42e1 19-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix memory leak when setting an invalid DOMDocument encoding

Because the failure path did not release the string, there was a memory
leak.
As the only valid types for this function a

Fix memory leak when setting an invalid DOMDocument encoding

Because the failure path did not release the string, there was a memory
leak.
As the only valid types for this function are IS_NULL and IS_STRING, we
and IS_NULL is always rejected in practice, solve the issue by not using
a function that increments the refcount in the first place.

Closes GH-12002.

show more ...


# d46dc569 23-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix various namespace prefix conflict resolution bugs and namespace shift bugs

There are two linked issues:

- Conflicts couldn't be resolved by changing the prefix name.
- Lacki

Fix various namespace prefix conflict resolution bugs and namespace shift bugs

There are two linked issues:

- Conflicts couldn't be resolved by changing the prefix name.
- Lacking a prefix would shift the namespace as the default namespace,
causing elements to suddenly become part of the namespace instead of
the attributes.

The output could still be improved by removing redundant namespace
declarations, but that's another issue. At least the output is
correct now.

Closes GH-11777.

show more ...


# 08c4db7f 06-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix manually calling __construct() on DOM classes

Closes GH-11894.


# 872bf56f 06-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Remove useless check

This is a remnant from the time the parser could be invoked statically.


# 6f6fedcb 02-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Handle strict error properly in adoptNode failure, and add a test


# 04df7765 02-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Deduplicate loading code


# fa397e02 02-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Respect strict error setting for adoptNode


# c283c3ab 15-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Sanitize libxml2 globals before parsing

Fixes GHSA-3qrf-m4j2-pcrr.

To parse a document with libxml2, you first need to create a parsing context.
The parsing context contains par

Sanitize libxml2 globals before parsing

Fixes GHSA-3qrf-m4j2-pcrr.

To parse a document with libxml2, you first need to create a parsing context.
The parsing context contains parsing options (e.g. XML_NOENT to substitute
entities) that the application (in this case PHP) can set.
Unfortunately, libxml2 also supports providing default set options.
For example, if you call xmlSubstituteEntitiesDefault(1) then the XML_NOENT
option will be added to the parsing options every time you create a parsing
context **even if the application never requested XML_NOENT**.

Third party extensions can override these globals, in particular the
substitute entity global. This causes entity substitution to be
unexpectedly active.

Fix it by setting the parsing options to a sane known value.
For API calls that depend on global state we introduce
PHP_LIBXML_SANITIZE_GLOBALS() and PHP_LIBXML_RESTORE_GLOBALS().
For other APIs that work directly with a context we introduce
php_libxml_sanitize_parse_ctxt_options().

show more ...


# ae66a0d1 26-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Corrections to return type of loading DOM documents


# 4bee5743 25-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-11792: LIBXML_NOXMLDECL is not implemented or broken

Fixes GH-11792.
Closes GH-11794.


# bf4e7bd3 25-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-11791: Wrong default value of DOMDocument::xmlStandalone

At one point this was changed from a bool to an int in libxml2, with
negative values meaning it is unspecified. Because it

Fix GH-11791: Wrong default value of DOMDocument::xmlStandalone

At one point this was changed from a bool to an int in libxml2, with
negative values meaning it is unspecified. Because it is cast to a bool
this therefore returned true instead of the expected false.

Closes GH-11793.

show more ...


# abb1d2e8 22-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix empty argument cases for DOMParentNode methods

Closes GH-11768.


# 0f205277 24-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Simplify configuration getters (#11778)

dom_get_doc_props_read_only() already does a NULL check.


# a73f38f4 17-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Implement DOMElement::insertAdjacent{Element,Text} (#11700)

* Implement DOMElement::insertAdjacent{Element,Text}

ref: https://dom.spec.whatwg.org/#dom-element-insertadjacentelement

Implement DOMElement::insertAdjacent{Element,Text} (#11700)

* Implement DOMElement::insertAdjacent{Element,Text}

ref: https://dom.spec.whatwg.org/#dom-element-insertadjacentelement
ref: https://dom.spec.whatwg.org/#dom-element-insertadjacenttext

Closes GH-11700.

show more ...


# d38cc9b9 11-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Implement DOMNode::isConnected and DOMNameSpaceNode::isConnected

ref: https://dom.spec.whatwg.org/#dom-node-isconnected

Closes GH-11677.


# e8f0bdc7 13-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix ?


# 6560c9bf 13-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Implement DOMParentNode::replaceChildren()

ref: https://dom.spec.whatwg.org/#dom-parentnode-replacechildren


12345678910>>...12