1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Co-authored-by: Alex Peattie <alexpeattie@gmail.com>

Closes GH-18490.
This commit is contained in:
Niels Dossche
2025-05-04 12:17:56 +02:00
parent a7b78a5091
commit 42ad1c64bf
3 changed files with 18 additions and 2 deletions

3
NEWS
View File

@@ -14,6 +14,9 @@ PHP NEWS
. Fixed bug GH-18481 (date_sunrise with unexpected nan value for the offset).
(nielsdos/David Carlier)
- DOM:
. Backport lexbor/lexbor#274. (nielsdos, alexpeattie)
- Intl:
. Fix various reference issues. (nielsdos)

View File

@@ -3,7 +3,7 @@
*
* Author: Alexander Borisov <borisov@lexbor.com>
* Adapted for PHP + libxml2 by: Niels Dossche <nielsdos@php.net>
* Based on Lexbor 2.4.0 (upstream commit e9d35f6384de7bd8c1b79e7111bc3a44f8822967)
* Based on Lexbor (upstream commit b347aa4e4da4e82b1cae18989ceea1aa0278daf1)
*/
#include <libxml/xmlstring.h>
@@ -970,7 +970,7 @@ lxb_selectors_state_has_relative(const xmlNode *node,
break;
}
while (node !=root && node->next == NULL) {
while (node != root && node->next == NULL && node->parent != NULL) {
node = node->parent;
}

View File

@@ -0,0 +1,13 @@
--TEST--
Lexbor #274
--EXTENSIONS--
dom
--FILE--
<?php
$dom = Dom\HTMLDocument::createFromString('<html><body><div></div>\n</body></html>', LIBXML_NOERROR);
var_dump($dom->querySelector('a:has(+ b)'));
?>
--EXPECT--
NULL