History log of /php-src/ext/dom/document.c (Results 1 – 25 of 303)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 3626e2d5 24-Apr-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Get rid of remaining usages of zval_try_get_string() (#14041)

This isn't necessary because the cases where we use it will always
succeed because the properties always have the type strin

Get rid of remaining usages of zval_try_get_string() (#14041)

This isn't necessary because the cases where we use it will always
succeed because the properties always have the type string|null.

show more ...


# 539d8d92 09-Mar-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Use common helper macro for getting the node in property handlers


# d57e7a92 09-Mar-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Use BAD_CAST consistently


# 37791d6f 09-Mar-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Cleanup buffer handling in saveHTML


# 6c55513e 09-Mar-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Use true instead of 1 with php_dom_throw_error


# 63bb04e5 09-Mar-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Simplify DOM_RET_OBJ macro


# 14b6c981 09-Mar-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

[RFC] Add a way to opt-in ext/dom spec compliance (#13031)

RFC: https://wiki.php.net/rfc/opt_in_dom_spec_compliance


# 035a5fdf 25-Feb-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Add LIBXML_RECOVER (#13504)

Setting the recovery option by using a hardcoded value (1) worked
already for SimpleXML. For DOM, a small change is necessary because
otherwise the recove

Add LIBXML_RECOVER (#13504)

Setting the recovery option by using a hardcoded value (1) worked
already for SimpleXML. For DOM, a small change is necessary because
otherwise the recover field overwrites the recovery option.

From a quick search on GitHub [1] it looks like this won't clash with
existing PHP code as no one seems to define (or use) a constant with
such a name.

[1] https://github.com/search?q=LIBXML_RECOVER+language%3APHP&type=code&l=PHP

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


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


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

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


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


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


# 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


12345678910>>...13