1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 18:53:33 +02:00
Commit Graph

1775 Commits

Author SHA1 Message Date
Niels Dossche 31ae40d5e1 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20444: Dom\XMLDocument::C14N() seems broken compared to DOMDocument::C14N()
2025-12-26 22:28:51 +01:00
Niels Dossche 40c291cf93 Fix GH-20444: Dom\XMLDocument::C14N() seems broken compared to DOMDocument::C14N()
C14N code expects namespace to be in-tree, but we store namespaces in a
different way out-of-tree to avoid reconciliations that break the tree
structure in a way unexpected by the DOM spec. In the DOM spec,
namespace nodes don't exist; they're regular attributes.
To solve this, we temporarily make fake namespace nodes that we later
remove.

Closes GH-20457.
2025-12-26 22:27:25 +01:00
Niels Dossche 735f354ac9 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20722: Null pointer dereference in DOM namespace node cloning via clone on malformed objects
2025-12-18 22:40:12 +01:00
Niels Dossche bf63341f35 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20722: Null pointer dereference in DOM namespace node cloning via clone on malformed objects
2025-12-18 22:39:57 +01:00
Niels Dossche 983be089c0 Fix GH-20722: Null pointer dereference in DOM namespace node cloning via clone on malformed objects
Closes GH-20730.
2025-12-18 22:39:35 +01:00
Ilija Tovilo ddc8512267 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Suppress libxml deprecations
2025-12-02 16:45:39 +01:00
Ilija Tovilo ed847f49c3 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Suppress libxml deprecations
2025-12-02 16:45:31 +01:00
Ilija Tovilo 685bd9de81 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Suppress libxml deprecations
2025-12-02 16:41:37 +01:00
Ilija Tovilo 26b9395ad6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Suppress libxml deprecations
2025-12-02 16:38:08 +01:00
Ilija Tovilo f7fb13eb07 Suppress libxml deprecations
Closes GH-20538
2025-12-02 16:37:50 +01:00
Niels Dossche abad39a42a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  dom: Fix missing NUL byte check on C14NFile()
2025-11-13 00:03:56 +01:00
Niels Dossche a103251eb2 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  dom: Fix missing NUL byte check on C14NFile()
2025-11-13 00:03:36 +01:00
Niels Dossche 8ad5915756 dom: Fix missing NUL byte check on C14NFile()
Closes GH-20466.
2025-11-13 00:03:13 +01:00
Niels Dossche f996abde33 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20395: \Dom\ParentNode::querySelector and \Dom\ParentNode::querySelectorAll requires elements in $selectors to be lowercase (#20409)
2025-11-12 19:34:41 +01:00
Niels Dossche 3ad5799f25 Fix GH-20395: \Dom\ParentNode::querySelector and \Dom\ParentNode::querySelectorAll requires elements in $selectors to be lowercase (#20409)
The selector needs to be compared in a lowercase manner.
This also almost completely obsoletes the interned string optimization,
so get rid of that for simplicity sake. While there is still theoretical
benefit, it is only 1-2% in my random tests, not worth it anymore.
2025-11-12 19:30:58 +01:00
Niels Dossche 131eb9e723 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix memory leak when edge case is hit when registering xpath callback
2025-11-11 15:30:11 +01:00
Niels Dossche e504ab778c Fix memory leak when edge case is hit when registering xpath callback
This can happen if you have a valid callable name with a NUL byte in it,
on a non-interned string entry. This can be done by abusing anonymous
classes.

Closes GH-20452.
2025-11-11 15:29:45 +01:00
Niels Dossche a0840e1428 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  dom: Fix compile warning due to misplaced const cast
2025-11-06 22:42:49 +01:00
Niels Dossche 37a6620587 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  dom: Fix compile warning due to misplaced const cast
2025-11-06 22:42:44 +01:00
Niels Dossche 7c96263cee dom: Fix compile warning due to misplaced const cast 2025-11-06 22:42:03 +01:00
Niels Dossche 6267bde370 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20281: \Dom\Document::getElementById() is inconsistent after nodes are removed
2025-10-25 12:24:03 +02:00
Niels Dossche cb1f9327c4 Fix GH-20281: \Dom\Document::getElementById() is inconsistent after nodes are removed
This worked for non-parsed elements already, but not for elements where
xmlAddID() returns early due to the ID already existing.
In that case what was missing is marking the attribute as an ID.

Closes GH-20283.
2025-10-25 12:23:42 +02:00
Niels Dossche 8392633f97 Fix getNamedItemNS() incorrect namespace check
Accidentally introduced while refactoring iterator handling.
The check ordering of namespace vs spec compliance was wrong.

Closes GH-20185.
2025-10-16 18:46:02 +02:00
Niels Dossche 599078f70b Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add forgotten NEWS item
  Partially fix GH-16317: DOM classes do not allow __debugInfo() overrides to work
2025-10-13 18:45:34 +02:00
Niels Dossche 39ef16a496 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Partially fix GH-16317: DOM classes do not allow __debugInfo() overrides to work
2025-10-13 18:44:57 +02:00
Niels Dossche 8e0504c38b Partially fix GH-16317: DOM classes do not allow __debugInfo() overrides to work
Closes GH-20132.
2025-10-13 18:43:24 +02:00
Nicolas Grekas fc353966f3 Revert deprecation of __sleep and __wakeup (#19966) 2025-10-06 10:30:27 +02:00
Niels Dossche 3a8e6a709a DOM Windows build fix (#20026) 2025-10-01 14:15:33 +02:00
Niels Dossche 52e1c9f110 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20022: docker-php-ext-install DOM failed
2025-10-01 13:05:49 +02:00
Niels Dossche b1d487a276 Fix GH-20022: docker-php-ext-install DOM failed
Closes GH-20023.
2025-10-01 13:00:59 +02:00
Gina Peter Banyard b4ed215299 core: Warn when non-representable floats are coerced to int (#19760)
RFC: https://wiki.php.net/rfc/warnings-php-8-5#casting_out_of_range_floats_to_int
2025-09-21 23:53:16 +01:00
Niels Dossche 542712099f Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix naming clash with libxml macro
2025-09-14 16:40:47 +02:00
Ruoyu Zhong 8774e96bd4 Fix naming clash with libxml macro
In the macOS 26 SDK, xmlFree is defined as a macro for free. This causes
issues where a same-named variable is used. Renaming the variable to
should_free resolves the issue.

See:

    $ grep -B4 -A2 -n "#define xmlFree(" "Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.sdk/usr/include/libxml/globals.h"
    261-#if defined(LIBXML_HAS_DEPRECATED_MEMORY_ALLOCATION_FUNCTIONS)
    262-#define xmlMalloc(size) malloc(size)
    263-#define xmlMallocAtomic(size) malloc(size)
    264-#define xmlRealloc(ptr, size) realloc((ptr), (size))
    265:#define xmlFree(ptr) free(ptr)
    266-#define xmlMemStrdup(str) strdup(str)
    267-#endif

Fixes:
```
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/libxml/xmlIO.h:117,
                    from /Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/libxml/parser.h:813,
                    from /private/tmp/php-20250914-13349-uqsk5o/php-8.4.12/ext/dom/php_dom.h:29,
                    from /private/tmp/php-20250914-13349-uqsk5o/php-8.4.12/ext/dom/attr.c:26:
    /private/tmp/php-20250914-13349-uqsk5o/php-8.4.12/ext/dom/attr.c: In function 'dom_compare_value':
    /private/tmp/php-20250914-13349-uqsk5o/php-8.4.12/ext/dom/attr.c:208:17: error: called object 'free' is not a function or function pointer
      208 |                 xmlFree(attr_value);
          |                 ^~~~~~~
    /private/tmp/php-20250914-13349-uqsk5o/php-8.4.12/ext/dom/attr.c:204:14: note: declared here
      204 |         bool free;
          |              ^~~~
    make: *** [ext/dom/attr.lo] Error 1
```

Closes GH-19832.

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2025-09-14 16:40:22 +02:00
Gina Peter Banyard a5f2eee785 Zend: Deprecate __wakeup() (#19435)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_sleep_and_wakeup_magic_methods
2025-09-11 06:57:21 +01:00
Gina Peter Banyard f18e99244b Zend: Deprecate __sleep() (#19682)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_sleep_and_wakeup_magic_methods
2025-09-10 08:54:16 +01:00
Niels Dossche 1847d9188c Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19612: Mitigate libxml2 tree dictionary bug
2025-09-03 21:58:21 +02:00
Niels Dossche 3023b29a11 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19612: Mitigate libxml2 tree dictionary bug
2025-09-03 21:58:16 +02:00
Niels Dossche 080fd14458 Fix GH-19612: Mitigate libxml2 tree dictionary bug
This code is very similar to code on PHP 8.4 and higher, but the
mitigation is extended to entity references and to attribute children.

Closes GH-19620.
2025-09-03 21:52:48 +02:00
Niels Dossche 3690df022b Fix Windows build 2025-08-25 00:23:09 +02:00
Niels Dossche c66af62511 Sync lexbor with master on PHP 8.4 2025-08-25 00:06:18 +02:00
Niels Dossche 91665eaa63 Backport Lexbor changes to 8.4 2025-08-10 14:17:19 +02:00
Niels Dossche aecf2a6e62 Fix GH-18877: \Dom\HTMLDocument querySelectorAll selecting only the first when using ~ and :has
Backports lexbor/lexbor@971faf11a5

Closes GH-19180.
2025-08-10 13:07:13 +02:00
DanielEScherzer 1eadf553f1 Arginfo: avoid using temporary zvals for initializing attribute values (#19141)
Instead of
* adding a zval on the stack
* initializing it
* copying the value to the attribute

Just initialize the value directly in the zend_attribute_arg
2025-07-21 13:33:51 -07:00
Niels Dossche 03a9f03822 Migrate from xmlNewNode to xmlNewDocNode (#19182)
The former is discouraged [1].

[1] https://gnome.pages.gitlab.gnome.org/libxml2/html/tree_8h.html#aa39c05fb472571ed00e38c065e67d2ec
2025-07-19 23:29:04 +02:00
Daniel Scherzer 142e378618 Arginfo: add and use known strings for attribute values 2025-07-14 17:31:22 -07:00
Niels Dossche 9121b015c1 Implement GH-18550: Implement getElementsByClassName() (#19108)
Spec: https://dom.spec.whatwg.org/#ref-for-dom-element-getelementsbyclassname
2025-07-14 21:53:37 +02:00
Niels Dossche f11ea2ae13 Refactor dom_html_collection_named_item()
This factors out the specific objmap handling to virtual functions.
This is the last step in preparation for GH-18550.
2025-07-11 12:29:29 +02:00
Niels Dossche a2d65354a0 dom: Rename get_named_item -> get_ns_named_item, and has_named_item -> has_ns_named_item 2025-07-11 12:29:29 +02:00
Niels Dossche 4aa8c2fe5d dom: Remove unnecessary objmap ptr null checks (#19092) 2025-07-11 10:35:14 +02:00
Niels Dossche e013b4a91e Make cloning DOM node lists, maps, and collections fail
This never worked and creates a broken object,
and on master can cause a crash with foreach.
It makes no sense to fix a behaviour that never worked, block it
instead.

Closes GH-19089.
2025-07-11 10:34:25 +02:00