#
1890d47c |
| 11-May-2024 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Fix missing deref in C14N (#14203) Follow-up for 30a0b0359ed8338c0e3acd1682de3cf96429e898, which didn't fix all places. This is the last remaining place.
|
#
30a0b035 |
| 30-Apr-2024 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Fix references not handled correctly in C14N Closes GH-14090.
|
#
e3711af8 |
| 09-Mar-2024 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Add ZPP checks in DOMNode::{__sleep,__wakeup} Closes GH-13651.
|
#
93951cf5 |
| 24-Dec-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Fix GH-13012: DOMNode::isEqualNode() is incorrect when attribute order is different Attributes (and namespace declarations) have to be compared in an unordered way. Closes GH-13
Fix GH-13012: DOMNode::isEqualNode() is incorrect when attribute order is different Attributes (and namespace declarations) have to be compared in an unordered way. Closes GH-13017.
show more ...
|
#
24e5e4ec |
| 08-Oct-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Fix GH-8996: DOMNode serialization on PHP ^8.1 PHP 8.1 introduced a seemingly unintentional BC break in ca94d55a19 by blocking the (un)serialization of DOM objects. This was done bec
Fix GH-8996: DOMNode serialization on PHP ^8.1 PHP 8.1 introduced a seemingly unintentional BC break in ca94d55a19 by blocking the (un)serialization of DOM objects. This was done because the serialization never really worked and just resulted in an empty object, which upon unserialization just resulted in an object that you can't use. Users can however implement their own serialization methods, but the commit made that impossible as the ACC flag gets passed down to the child class. An approach was tried in #10307 with a new ACC flag to selectively allow serialization with subclasses if they implement the right methods. However, that was found to be too ad hoc. Instead, let's abuse how the __sleep and __wakeup methods work to throw the exception instead. If the child class implements the __serialize / __unserialize method, then the throwing methods won't be called. Similarly, if the child class implements __sleep and __wakeup, then they're overridden and it doesn't matter that they throw. For the user, this PR has the exact same behaviour for (sub)classes that don't implement the serialization methods: an exception will be thrown. For code that previously implemented subclasses with these methods, this approach will make that code work again. This approach should be both BC preserving and unbreak user's code. Closes GH-12388. For the test: Co-authored-by: wazelin <contact@sergeimikhailov.com>
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 ...
|
#
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 ...
|