From b9a43adf958d69e96e2ff44621ba376b4e0ad2ba Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 21 Oct 2024 19:29:28 +0200 Subject: [PATCH 1/2] Adapt tests for libxml2 >= 2.13.0 libxml2 2.13.0 introduced some relevant changes regarding the treatment of file paths on Windows[1]. Thus we un-xfail bug69753.phpt and its companion, and we adjust dom004.phpt. [1] --- ext/dom/tests/dom004.phpt | 2 +- ext/libxml/tests/bug69753-mb.phpt | 5 ++--- ext/libxml/tests/bug69753.phpt | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ext/dom/tests/dom004.phpt b/ext/dom/tests/dom004.phpt index 457b764abfb64..8656d2becf7b8 100644 --- a/ext/dom/tests/dom004.phpt +++ b/ext/dom/tests/dom004.phpt @@ -9,7 +9,7 @@ in_array('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrap --FILE-- load("compress.zlib://".__DIR__."/book.xml.gz"); +$dom->load("compress.zlib://" . str_replace("\\", "/", __DIR__) . "/book.xml.gz"); print $dom->saveXML(); ?> --EXPECT-- diff --git a/ext/libxml/tests/bug69753-mb.phpt b/ext/libxml/tests/bug69753-mb.phpt index e89034db16268..6f358f94bf098 100644 --- a/ext/libxml/tests/bug69753-mb.phpt +++ b/ext/libxml/tests/bug69753-mb.phpt @@ -1,12 +1,11 @@ --TEST-- Bug #69753 - libXMLError::file contains invalid URI ---XFAIL-- -Awaiting upstream fix: https://gitlab.gnome.org/GNOME/libxml2/-/issues/611 --EXTENSIONS-- dom --SKIPIF-- --FILE-- file); ?> --EXPECTF-- -string(%d) "file:///%s/ext/libxml/tests/bug69753.xml" +string(%d) "%s\ext\libxml\tests\bug69753私はガラスを食べられます.xml" diff --git a/ext/libxml/tests/bug69753.phpt b/ext/libxml/tests/bug69753.phpt index bd2a9c0b82581..e9f0c56c2ee0a 100644 --- a/ext/libxml/tests/bug69753.phpt +++ b/ext/libxml/tests/bug69753.phpt @@ -1,12 +1,11 @@ --TEST-- Bug #69753 - libXMLError::file contains invalid URI ---XFAIL-- -Awaiting upstream fix: https://gitlab.gnome.org/GNOME/libxml2/-/issues/611 --EXTENSIONS-- dom --SKIPIF-- --FILE-- file); ?> --EXPECTF-- -string(%d) "file:///%s/ext/libxml/tests/bug69753.xml" +string(%d) "%s\ext\libxml\tests\bug69753.xml" From 9faf228e75b710b5a6bd4597c4322aa5135acc18 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 21 Oct 2024 20:56:16 +0200 Subject: [PATCH 2/2] Deactivate workaround for erroneous file:/ URIs on Windows --- ext/libxml/libxml.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index a72aad5038de0..f07b3214ee823 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -423,10 +423,11 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char (xmlStrncmp(BAD_CAST uri->scheme, BAD_CAST "file", 4) == 0))) { resolved_path = xmlURIUnescapeString(filename, 0, NULL); isescaped = 1; -#if LIBXML_VERSION >= 20902 && defined(PHP_WIN32) +#if LIBXML_VERSION >= 20902 && LIBXML_VERSION < 21300 && defined(PHP_WIN32) /* Libxml 2.9.2 prefixes local paths with file:/ instead of file://, thus the php stream wrapper will fail on a valid case. For this - reason the prefix is rather better cut off. */ + reason the prefix is rather better cut off. + As of libxml 2.13.0 this issue is resolved. */ { size_t pre_len = sizeof("file:/") - 1;