History log of /PHP-8.2/ext/dom/document.c (Results 1 – 25 of 284)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 4fe82131 04-Jul-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Backport libxml2 2.13.2 fixes (#14816)

Backproted from https://github.com/php/php-src/pull/14789


# 42908f9f 28-Jun-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-14702: DOMDocument::xinclude() crash

The xinclude code from libxml removes the fallback node,
but the fallback node is still reference via $fallback.
The solution is to detach

Fix GH-14702: DOMDocument::xinclude() crash

The xinclude code from libxml removes the fallback node,
but the fallback node is still reference via $fallback.
The solution is to detach the nodes that are going to be removed in
advance.

Closes GH-14704.

show more ...


# 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 ...


# 82baeeb1 16-Dec-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Some more DOM testing and code style updates (#12933)


# 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 ...


# 9c306470 04-Dec-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Handle libxml2 OOM more consistently (#11927)

This is a continuation of commit c2a58ab07d, in which several OOM error
handling was converted to throwing an INVALID_STATE_ERR DOMException

Handle libxml2 OOM more consistently (#11927)

This is a continuation of commit c2a58ab07d, in which several OOM error
handling was converted to throwing an INVALID_STATE_ERR DOMException.
Some places were missed and they still returned false without an
exception, or threw a PHP_ERR DOMException.
Convert all of these to INVALID_STATE_ERR DOMExceptions. This also
reduces confusion of users going through documentation [1].

Unfortunately, not all node creations are checked for a NULL pointer.
Some places therefore will not do anything if an OOM occurs (well,
except crash).
On the one hand it's nice to handle these OOM cases.
On the other hand, this adds some complexity and it's very unlikely to
happen in the real world. But then again, "unlikely" situations have
caused trouble before. Ideally all cases should be checked.

[1] https://github.com/php/doc-en/issues/1741

show more ...


# ae83d6ab 29-Nov-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix issues related to libxml2 2.12.0 (#12802)

* Avoid passing NULL to xmlSwitchToEncoding

This otherwise switches to UTF-8 on libxml2 2.12.0

* Split tests for different err

Fix issues related to libxml2 2.12.0 (#12802)

* Avoid passing NULL to xmlSwitchToEncoding

This otherwise switches to UTF-8 on libxml2 2.12.0

* Split tests for different error reporting behaviour in libxml2 2.12.0

* Avoid deprecation warnings for libxml2 2.12.0

We can't fully get rid of the parser globals as there are still APIs
that implicitly use them.

* Temporarily disable part of test for libxml 2.12.0 regression

See https://gitlab.gnome.org/GNOME/libxml2/-/issues/634

* Review fixes

* [ci skip] Update test description

show more ...


# 1492be52 13-Nov-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

[RFC] DOM HTML5 parsing and serialization support (#12111)


# 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 ...


# f2fede56 08-Sep-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Deduplicate ParentNode and ChildNode interface implementations using @implementation-alias

The entry points are duplicated: they add bloat and make it easier to forget
to change somethin

Deduplicate ParentNode and ChildNode interface implementations using @implementation-alias

The entry points are duplicated: they add bloat and make it easier to forget
to change something. Make maintenance easier by using @implementation-alias.
Also, this has the nice side-effect of slightly reducing the amount of
code and binary size.

Closes GH-12158.

show more ...


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

Use zend_result as return for properties in ext/dom (#12113)


# 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 ...


# 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


# 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.


# 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


# 87e7b61d 02-Jul-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Cleanup macro usage in ext/dom and ext/libxml

With the new lifetime system in place, we can simplify some macros.


12345678910>>...12