Commit e4f045070ea for php

commit e4f045070eace18e43618d4f2f0116d72d02af69
Author: ndossche <7771979+ndossche@users.noreply.github.com>
Date:   Mon Nov 9 19:02:07 2026 +0100

    Fix GH-25306: Assertion status == LXB_STATUS_OK in dom_parse_selector when lexbor allocation fails

    Closes GH-25348.

diff --git a/NEWS b/NEWS
index 9397cd352ab..18ec48a2acf 100644
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,8 @@ PHP                                                                        NEWS
 - DOM:
   . Fixed bug GH-25268 (NULL php_libxml_ref_obj dereference in
     dom_objects_store_clone_obj when cloning Dom\Notation). (David Carlier)
+  . Fixed bug GH-25306 (Assertion status == LXB_STATUS_OK in dom_parse_selector
+    when lexbor allocation fails). (ndossche)

 - GD:
   . Fixed use-after-free when drawing with a brush or tile image that was
diff --git a/ext/dom/parentnode/css_selectors.c b/ext/dom/parentnode/css_selectors.c
index 43012c4ebb9..8dd483ff0b6 100644
--- a/ext/dom/parentnode/css_selectors.c
+++ b/ext/dom/parentnode/css_selectors.c
@@ -83,11 +83,15 @@ static lxb_css_selector_list_t *dom_parse_selector(

 	memset(parser, 0, sizeof(lxb_css_parser_t));
 	status = lxb_css_parser_init(parser, NULL);
-	ZEND_ASSERT(status == LXB_STATUS_OK);
+	if (UNEXPECTED(status != LXB_STATUS_OK)) {
+		return NULL;
+	}

 	memset(selectors, 0, sizeof(lxb_selectors_t));
 	status = lxb_selectors_init(selectors);
-	ZEND_ASSERT(status == LXB_STATUS_OK);
+	if (UNEXPECTED(status != LXB_STATUS_OK)) {
+		return NULL;
+	}
 	lxb_selectors_opt_set(selectors, dom_quirks_opt(options, intern));

 	lxb_css_selector_list_t *list = lxb_css_selectors_parse(parser, (const lxb_char_t *) ZSTR_VAL(selectors_str), ZSTR_LEN(selectors_str));