History log of /PHP-8.2/ext/dom/php_dom.c (Results 1 – 25 of 293)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 9fc7be8c 10-Feb-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Use bools


# 79e31c23 10-Feb-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Don't use heap allocations for registering DOM property handlers


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

Cleanup useless stuff in php_dom.c


# 90785dd8 12-Jan-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

[RFC] Improve callbacks in ext/dom and ext/xsl (#12627)


# 2b30f187 12-Jan-2024 Tim Düsterhus

Remove unused includes of php_random.h (#13131)

Before this change php_random.h was listed in 146 different *.dep files for a

env CC=clang ./configure --without-sqlite3 --withou

Remove unused includes of php_random.h (#13131)

Before this change php_random.h was listed in 146 different *.dep files for a

env CC=clang ./configure --without-sqlite3 --without-pdo-sqlite

build, after this change it's only listed in 110 of them, preventing uselessly
recompiling those files when working on ext/random, mostly caused by the include
in ext/standard/basic_functions.h.

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


# 9a34b57b 20-Nov-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

ext/dom: Use zend_hash_add_new variant when registering classes and properties


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

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


# 3e33eda3 28-Oct-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix cloning attribute with namespace disappearing namespace

Closes GH-12547.


# 7f46c87f 17-Oct-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Cleanup unused variable in php_dom.c (#12463)


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


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

Fix #80927: Removing documentElement after creating attribute node: possible use-after-free

Closes GH-11892.


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

Implement DOMNode::parentElement and DOMNameSpaceNode::parentElement

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

Closes GH-11679.


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


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

Implement DOMElement::id

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

Closes GH-11701.


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

Implement DOMElement::className

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

Closes GH-11691.


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

Fix GH-9628: Implicitly removing nodes from \DOMDocument breaks existing references

Change the way lifetime works in ext/libxml and ext/dom

Previously, a node could be freed even wh

Fix GH-9628: Implicitly removing nodes from \DOMDocument breaks existing references

Change the way lifetime works in ext/libxml and ext/dom

Previously, a node could be freed even when holding a userland reference
to it. This resulted in exceptions when trying to access that node after
it has been implicitly or explicitly removed. After this patch, a node
will only be freed when the last userland reference disappears.

Fixes GH-9628.
Closes GH-11576.

show more ...


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

Remove always-false check

There are no prop handlers with a NULL key.


# 941a7e59 26-Jun-2023 nielsdos <7771979+nielsdos@users.noreply.github.com>

Avoid allocation when getting the node content, if possible

Closes GH-11543.


# 21c1fb6a 27-Jun-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Two tiny ext/dom cleanups (#11541)

* Remove obsolete workaround code

This code was for libxml2 <= 2.6.14. PHP requires at least libxml2
2.9.0.

* Use an inline check ins

Two tiny ext/dom cleanups (#11541)

* Remove obsolete workaround code

This code was for libxml2 <= 2.6.14. PHP requires at least libxml2
2.9.0.

* Use an inline check instead of calling into the library for an empty string check

show more ...


# 961e57eb 25-Jun-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-11500: Namespace reuse in createElementNS() generates wrong output

When you construct a DOM tree containing subtrees which are constructed
top-down, this won't remove the redundan

Fix GH-11500: Namespace reuse in createElementNS() generates wrong output

When you construct a DOM tree containing subtrees which are constructed
top-down, this won't remove the redundant namespaces. That's because the
following conditions hold:
1) The namespace are reused from the doc->oldNs list.
2) Therefore during reconciliation no nsDef field is set, so no redundant
namespaces are removed by our reconciliation code.

Furthermore, it would only be fixed up automatically if the tree wasn't
added in bottom-up way, or if it had been constructed bottom-up from the
start.

Fix it by setting a flag to remove redundant namespaces in the libxml2
reconciliation call.
Since removing redundant namespaces may have a performance cost, we only do
this after performing a simple check.

Closes GH-11528.

show more ...


# a38e3c99 05-Jun-2023 nielsdos <7771979+nielsdos@users.noreply.github.com>

Fix #79700: Bad performance with namespaced nodes due to wrong libxml assumption

* Use a prepending strategy instead of appending in dom_set_old_ns()

Looping to the end of the list

Fix #79700: Bad performance with namespaced nodes due to wrong libxml assumption

* Use a prepending strategy instead of appending in dom_set_old_ns()

Looping to the end of the list is wasteful. We can just put the new
nodes at the front of the list. I don't believe we can fully prepend,
because libxml2 may assume that the xml namespace is the first one, so
we'll put the new ones as the second one.

* Reuse namespaces from doc->oldNs if possible in dom_get_ns()

* Add a test for reconciling a reused namespace

* Explain why there can't be a cycle between oldNs and nsDef

Closes GH-11376.

Also fixes #77894.

show more ...


# 74910b14 22-Dec-2022 Tim Starling

Factor out dom_remove_all_children()

A few callers remove all children of a node. The way it was done in
node.c was unsafe, because it left nodep->last dangling. It just happens
to n

Factor out dom_remove_all_children()

A few callers remove all children of a node. The way it was done in
node.c was unsafe, because it left nodep->last dangling. It just happens
to not crash if xmlNodeSetContent() is called immediately afterwards.

show more ...


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

Implement iteration cache, item cache and length cache for node list iteration (#11330)

* Implement iteration cache, item cache and length cache for node list iteration

The current

Implement iteration cache, item cache and length cache for node list iteration (#11330)

* Implement iteration cache, item cache and length cache for node list iteration

The current implementation follows the spec requirement that the list
must be "live". This means that changes in the document must be
reflected in the existing node lists without requiring the user to
refetch the node list.
The consequence is that getting any item, or the length of the list,
always starts searching from the root element of the node list. This
results in O(n) time to get any item or the length. If there's a for
loop over the node list, this means the iterations will take O(n²) time
in total. This causes real-world performance issues with potential for
downtime (see GH-11308 and its references for details).

We fix this by introducing a caching strategy. We cache the last
iterated object in the iterator, the last requested item in the node
list, and the last length computation. To invalidate the cache, we
simply count the number of modifications made to the containing
document. If the modification number does not match what the number was
during caching, we know the document has been modified and the cache is
invalid. If this ever overflows, we saturate the modification number and
don't do any caching anymore. Note that we don't check for overflow on
64-bit systems because it would take hundreds of years to overflow.

Fixes GH-11308.

show more ...


12345678910>>...12