History log of /php-src/ext/dom/node.c (Results 51 – 75 of 235)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 880faa39 08-Sep-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Add DOMNode::compareDocumentPosition() (#12146)

Reference: https://dom.spec.whatwg.org/#dom-node-comparedocumentposition


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

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


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

Get rid of some unnecessary string conversion (#11733)

For typed properties that are of type "string", we don't need to do any
conversion as the zval will already be a string. Removing t

Get rid of some unnecessary string conversion (#11733)

For typed properties that are of type "string", we don't need to do any
conversion as the zval will already be a string. Removing this
simplifies code and avoids unnecessary refcounting.

show more ...


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

Implement DOMNode::isEqualNode()

Since we still support obsoleted nodes in our implementation, this uses
the old spec to match the old nodes; and this uses the new spec for
nodes sti

Implement DOMNode::isEqualNode()

Since we still support obsoleted nodes in our implementation, this uses
the old spec to match the old nodes; and this uses the new spec for
nodes still defined in the living spec.
When unclear, the behaviour was cross-verified with Firefox.

References:
https://dom.spec.whatwg.org/#dom-node-isequalnode (for everything still in the living spec)
https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/DOM3-Core.html#core-Node3-isEqualNode (for old nodes removed from the living spec)

Closes GH-11690.

show more ...


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

Fix build on Windows


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


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

Implement DOMNode::getRootNode()

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

Closes GH-11693.


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

Refactor dom_node_node_name_read() to avoid double allocation

We will use this helper later outside of the node name read handler.


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

Implement DOMNode::contains()

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


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

Avoid allocation when getting the node content, if possible

Closes GH-11543.


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

Revert changes to DOMAttr::$value and DOMAttr::$nodeValue expansion

Closes GH-11469.


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


# d5ad7510 08-Jun-2023 George Peter Banyard

More usage of known zend_str instead of C string (#11381)


# 076ddf2b 22-Dec-2022 Tim Starling

Also avoid entity expansion in DOMAttr::$nodeValue


# ee68c221 22-Dec-2022 Tim Starling

Don't add 1 when calling xmlNodeSetContent()

The length is passed to xmlStrndup(), which also adds 1, and adds a null
terminator past the end. It worked because the length is not actuall

Don't add 1 when calling xmlNodeSetContent()

The length is passed to xmlStrndup(), which also adds 1, and adds a null
terminator past the end. It worked because the length is not actually
stored. Strings in libxml2 are null terminated. Passing the length just
avoids a call to strlen().

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


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

Fix bug #67440: append_node of a DOMDocumentFragment does not reconcile namespaces

The test was amended from the original issue report. For the test:
Co-authored-by: php@deep-freeze.ca

Fix bug #67440: append_node of a DOMDocumentFragment does not reconcile namespaces

The test was amended from the original issue report. For the test:
Co-authored-by: php@deep-freeze.ca

The problem is that the regular dom_reconcile_ns() only works on a
single node. We actually have to reconciliate the whole tree in case a
fragment was added. This also required to move some code around such
that this special case could be handled separately.

Closes GH-11362.

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


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

Fix GH-10234: Setting DOMAttr::textContent results in an empty attribute value

We can't directly call xmlNodeSetContent, because it might encode the string
through xmlStringLenGetNodeLis

Fix GH-10234: Setting DOMAttr::textContent results in an empty attribute value

We can't directly call xmlNodeSetContent, because it might encode the string
through xmlStringLenGetNodeList for types
XML_DOCUMENT_FRAG_NODE, XML_ELEMENT_NODE, XML_ATTRIBUTE_NODE.
In these cases we need to use a text node to avoid the encoding.
For the other cases, we *can* rely on xmlNodeSetContent because it is either
a no-op, or handles the content without encoding and clears the properties
field if needed.

The test was taken from the issue report, for the test:
Co-authored-by: ThomasWeinert <thomas@weinert.info>

Closes GH-10245.

show more ...


# 7936c808 23-Jan-2023 Máté Kocsis

Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385)


Revision tags: php-8.2.0RC1, php-8.1.10, php-8.0.23
# 742b4bac 19-Aug-2022 Christoph M. Becker

Merge branch 'PHP-8.1'

* PHP-8.1:
Fix #79451: DOMDocument->replaceChild on doctype causes double free


# 9bd9e9a8 19-Aug-2022 Christoph M. Becker

Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
Fix #79451: DOMDocument->replaceChild on doctype causes double free


Revision tags: php-8.0.23RC1, php-8.1.10RC1, php-8.2.0beta3
# 6027d441c 04-Aug-2022 NathanFreeman <1056159381@qq.com>

Fix #79451: DOMDocument->replaceChild on doctype causes double free

We have to reset intSubset if replacing doctype with another doctype node.

Closes GH-9201.
Closes GH-9376.

12345678910