History log of /PHP-8.1/ext/dom/document.c (Results 1 – 25 of 254)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 6a76e5d0 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 ...


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


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

Fix manually calling __construct() on DOM classes

Closes GH-11894.


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


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


# c174ebfc 19-Jun-2023 nielsdos <7771979+nielsdos@users.noreply.github.com>

Revert "Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM"

This reverts commit 7eb3e9cd173fbdd39e

Revert "Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM"

This reverts commit 7eb3e9cd173fbdd39eefa791aab610858e76399d.

Although the fix follows the spec, it causes issues because a lot of old
code assumes the incorrect behaviour PHP had since a long time.
We cannot do this yet, especially not in a stable release.
We revert this for the time being.
See GH-11428.

show more ...


# 7eb3e9cd 16-Jun-2023 nielsdos <7771979+nielsdos@users.noreply.github.com>

Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM

The NULL namespace is only correct when there i

Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM

The NULL namespace is only correct when there is no default namespace
override. When there is, we need to manually set it to the empty string
namespace.

Closes GH-11428.

show more ...


# 0e34ac86 04-Jun-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix bug #77686: Removed elements are still returned by getElementById

From the moment an ID is created, libxml2's behaviour is to cache that element,
even if that element is not yet atta

Fix bug #77686: Removed elements are still returned by getElementById

From the moment an ID is created, libxml2's behaviour is to cache that element,
even if that element is not yet attached to the document. Similarly, only upon
destruction of the element the ID is actually removed by libxml2.
Since libxml2 has such behaviour deeply ingrained in the library, and uses the
cache for various purposes, it seems like a bad idea and lost cause to fight it.
Instead, we'll simply walk the tree upwards to check if the node is attached to
the document.

Closes GH-11369.

show more ...


# ec10b28d 27-Jan-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix array overrun when appending slash to paths

Fix it by extending the array sizes by one character. As the input is
limited to the maximum path length, there will always be place to ap

Fix array overrun when appending slash to paths

Fix it by extending the array sizes by one character. As the input is
limited to the maximum path length, there will always be place to append
the slash. As the php_check_specific_open_basedir() simply uses the
strings to compare against each other, no new failures related to too
long paths are introduced.
We'll let the DOM and XML case handle a potentially too long path in the
library code.

show more ...


Revision tags: php-8.1.7RC1, php-8.1.4RC1, php-8.1.3, php-8.1.2RC1, php-8.1.0, php-7.3.33, php-7.3.32, php-7.3.31, php-7.3.30, php-7.3.29
# c2a58ab0 26-May-2021 Nikita Popov

Throw DomException for DOM out-of-memory error conditions

A number of error conditions in DOM can only occur if libxml2 runs
out of memory, at least as far as I can see. In such cases we

Throw DomException for DOM out-of-memory error conditions

A number of error conditions in DOM can only occur if libxml2 runs
out of memory, at least as far as I can see. In such cases we
currently do a silent "return false", which violates the DOM spec,
and which code is very unlikely to handle sensibly.

Switch these to throw a DomException with INVALID_STATE_ERR type.
This error type is chosen because we use for similar checks
elsewhere, for example:
https://github.com/php/php-src/blob/a733b1ada7895f6fa5e349755a878cae9189e3f5/ext/dom/documentfragment.c#L45-L48

This changes some of the more obvious cases I spotted, but there are probably more.

Closes GH-7049.

show more ...


# aff36587 29-Jun-2021 Patrick Allaert

Fixed some spaces used instead of tabs


# 01b3fc03 06-May-2021 KsaR

Update http->https in license (#6945)

1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as

Update http->https in license (#6945)

1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |

show more ...


Revision tags: php-7.3.28
# e0aab741 16-Mar-2021 Máté Kocsis

Promote DOM invalid state errors during property access

Closes GH-6780


# ab92ffee 09-Feb-2021 Nikita Popov

Make getElementsByTagNameNS $namespace nullable

According to the DOM specification, this argument is supposed to
be nullable.


Revision tags: php-7.3.27
# 3e01f5af 15-Jan-2021 Nikita Popov

Replace zend_bool uses with bool

We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool

Replace zend_bool uses with bool

We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.

show more ...


Revision tags: php-7.3.26, php-7.3.26RC1, php-7.3.25, php-7.3.25RC1, php-7.3.24
# 6d2bc725 23-Oct-2020 Christoph M. Becker

Fix #80268: loadHTML() truncates at NUL bytes

libxml2 has no particular issues parsing HTML strings with NUL bytes;
these just cause truncation of the current text content, but parsing

Fix #80268: loadHTML() truncates at NUL bytes

libxml2 has no particular issues parsing HTML strings with NUL bytes;
these just cause truncation of the current text content, but parsing
continues generally. Since `::loadHTMLFile()` already supports NUL
bytes, `::loadHTML()` should as well.

Note that this is different from XML, which does not allow any NUL
bytes.

Closes GH-6368.

show more ...


Revision tags: php-7.3.24RC1, php-7.3.23
# f3c58a5e 25-Sep-2020 Dik Takken

Make handling of NULL bytes in file paths more consistent (WIP)

Not all extensions consistently throw exceptions when the user passes
a path name containing null bytes. Also, some extens

Make handling of NULL bytes in file paths more consistent (WIP)

Not all extensions consistently throw exceptions when the user passes
a path name containing null bytes. Also, some extensions would throw
a ValueError while others would throw a TypeError. Error messages
also varied.

Now a ValueError is thrown after all failed path checks, at least for
as far as these occur in functions that are exposed to userland.

Closes GH-6216.

show more ...


# 72e8719e 23-Sep-2020 Máté Kocsis

Fix a few ZEND_UNREACHABLE() calls


Revision tags: php-7.3.23RC1, php-7.3.22, php-7.3.22RC1, php-7.3.21, php-7.3.21RC1, php-7.3.20, php-7.3.20RC1, php-7.3.19, php-7.4.7RC1, php-7.3.19RC1, php-7.3.18RC1
# 8fef83dd 19-Apr-2020 George Peter Banyard

Promote warnings to error in DOM extension

Closes GH-5418


# d30cd7d7 26-May-2020 Máté Kocsis

Review the usage of apostrophes in error messages

Closes GH-5590


# 2b5de6f8 01-Jul-2020 Max Semenik

Remove proto comments from C files

Closes GH-5758


# c9bc7dd1 25-Jun-2020 Nikita Popov

Don't throw warning if exception thrown during dom validation


1234567891011