Commit c428137c9bd for php

commit c428137c9bd221bc87dc52c6456a6539b08f41f6
Merge: 0fcec730405 ebfad221fb9
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date:   Sat Nov 21 08:20:38 2026 -0500

    Merge branch 'PHP-8.4' into PHP-8.5

    * PHP-8.4:
      ext/dom: Fix crash in named node map iterator key() without a current item

diff --cc NEWS
index f33a114c4cc,dd7e8988250..f28d555fbd5
--- a/NEWS
+++ b/NEWS
@@@ -51,6 -53,10 +51,8 @@@ PH
    . Fixed crash when registerNodeClass() is given a class with a constant
      expression that cannot be evaluated; registerNodeClass() now throws the
      evaluation Error instead. (Ilia Alshanetsky)
 -  . Fixed bug GH-25501 (querySelector() rejects a selector whose identifier
 -    starts with a non-ASCII character). (David Carlier)
+   . Fixed a crash and a use-after-free in key() of an attribute or DTD named
+     node map iterator that has no current item. (Ilia Alshanetsky)

  - Filter:
    . Fixed stack overflow in filter_var() and filter_var_array() with deeply
diff --cc ext/dom/dom_iterators.c
index 90e973723f6,d2a9bfb5486..e998d8ccf41
--- a/ext/dom/dom_iterators.c
+++ b/ext/dom/dom_iterators.c
@@@ -119,8 -131,10 +119,10 @@@ static void php_dom_iterator_current_ke

  	/* Only dtd named node maps, i.e. the ones based on a libxml hash table or attribute collections,
  	 * are keyed by the name because in that case the name is unique. */
 -	if (objmap->nodetype != XML_ATTRIBUTE_NODE && objmap->nodetype != XML_ENTITY_NODE && objmap->nodetype != XML_NOTATION_NODE) {
 +	if (objmap->handler->nameless) {
  		ZVAL_LONG(key, iterator->index);
+ 	} else if (Z_TYPE(iterator->curobj) != IS_OBJECT) {
+ 		ZVAL_NULL(key);
  	} else {
  		dom_object *intern = Z_DOMOBJ_P(&iterator->curobj);