Skip to content

Commit b6667c4

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Backport lexbor/lexbor#274
2 parents c0371d3 + 42ad1c6 commit b6667c4

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

ext/dom/lexbor/lexbor/selectors-adapted/selectors.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Author: Alexander Borisov <borisov@lexbor.com>
55
* Adapted for PHP + libxml2 by: Niels Dossche <nielsdos@php.net>
6-
* Based on Lexbor 2.4.0 (upstream commit e9d35f6384de7bd8c1b79e7111bc3a44f8822967)
6+
* Based on Lexbor (upstream commit b347aa4e4da4e82b1cae18989ceea1aa0278daf1)
77
*/
88

99
#include <libxml/xmlstring.h>
@@ -967,7 +967,7 @@ lxb_selectors_state_has_relative(const xmlNode *node,
967967
break;
968968
}
969969

970-
while (node !=root && node->next == NULL) {
970+
while (node != root && node->next == NULL && node->parent != NULL) {
971971
node = node->parent;
972972
}
973973

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Lexbor #274
3+
--EXTENSIONS--
4+
dom
5+
--FILE--
6+
<?php
7+
8+
$dom = Dom\HTMLDocument::createFromString('<html><body><div></div>\n</body></html>', LIBXML_NOERROR);
9+
var_dump($dom->querySelector('a:has(+ b)'));
10+
11+
?>
12+
--EXPECT--
13+
NULL

0 commit comments

Comments
 (0)