From 673cb6d7a32fea9e41b2061ca5197718f29f806f Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 25 May 2026 23:11:41 +0100 Subject: [PATCH 1/2] Fix GH-22138: skip libxml/xmlreader tests on non-ASCII paths. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libxml2 2.13+ rejects unencoded non-ASCII bytes in SYSTEM URIs via xmlBuildURISafe and emits "Can't resolve URI", which breaks four tests when the source tree lives under a path like "~/下载/". Skip them with a clear reason on such paths, and loosen the EXPECTF for the two tests that previously matched only "failed to load" so both libxml2 message formats are accepted. close GH-22150 --- ext/libxml/tests/bug61367-read_2.phpt | 3 ++- ext/libxml/tests/libxml_disable_entity_loader_2.phpt | 3 ++- .../tests/libxml_entity_loading_disabled_by_default.phpt | 4 ++++ ext/xmlreader/tests/012.phpt | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ext/libxml/tests/bug61367-read_2.phpt b/ext/libxml/tests/bug61367-read_2.phpt index f4b0f300293c..ec4ce827336b 100644 --- a/ext/libxml/tests/bug61367-read_2.phpt +++ b/ext/libxml/tests/bug61367-read_2.phpt @@ -5,6 +5,7 @@ dom --SKIPIF-- = 2.9.12 only'); +if (preg_match('/[^\x00-\x7F]/', __DIR__)) die('skip path contains non-ASCII characters that libxml URI parser rejects'); ?> --INI-- open_basedir=. @@ -58,6 +59,6 @@ bool(true) int(4) bool(true) -%s: DOMDocument::loadXML(): %Sfailed to load %s +%s: DOMDocument::loadXML(): %s Warning: Attempt to read property "nodeValue" on null in %s on line %d diff --git a/ext/libxml/tests/libxml_disable_entity_loader_2.phpt b/ext/libxml/tests/libxml_disable_entity_loader_2.phpt index fb71c0c8d756..be386154bb20 100644 --- a/ext/libxml/tests/libxml_disable_entity_loader_2.phpt +++ b/ext/libxml/tests/libxml_disable_entity_loader_2.phpt @@ -6,6 +6,7 @@ dom --SKIPIF-- = 2.9.12 only'); +if (preg_match('/[^\x00-\x7F]/', __DIR__)) die('skip path contains non-ASCII characters that libxml URI parser rejects'); ?> --FILE-- --FILE-- --FILE-- Date: Fri, 29 May 2026 00:27:54 -0700 Subject: [PATCH 2/2] Define LEXBOR_STATIC in CFLAGS_URI for static ext/uri on Windows (#22165) ext/uri is always built statically (false /* never shared */ in EXTENSION()) and includes the bundled lexbor headers via /I ext/lexbor. On Windows, lexbor's LXB_API macro defaults to __declspec(dllimport), which produces LNK2019 unresolved external symbol errors for every lxb_* function referenced from ext/uri when PHP itself is linked statically without a runtime DLL. Adding /D LEXBOR_STATIC to CFLAGS_URI in ext/uri/config.w32 makes LXB_API expand to nothing for ext/uri's compilation units. The scope matches URI_STATIC_BUILD on the same line: per-consumer, because other lexbor consumers (e.g. ext/dom, which can build as shared) must decide for themselves whether to disable the dllimport decoration. --- NEWS | 5 +++++ ext/uri/config.w32 | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ae3cae760320..d16352c26134 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,11 @@ PHP NEWS . Fixed bug GH-22121 (Double free in gdImageSetStyle() after overflow-triggered early return). (iliaal) +- URI: + . Add LEXBOR_STATIC to CFLAGS_URI on Windows so ext/uri does not see + LXB_API as __declspec(dllimport) when linked statically into PHP. + (Luther Monson) + - Zlib: . Fixed memory leak if deflate initialization fails and there is a dict. (ndossche) diff --git a/ext/uri/config.w32 b/ext/uri/config.w32 index 97c10caf098f..f26ffac629eb 100644 --- a/ext/uri/config.w32 +++ b/ext/uri/config.w32 @@ -2,7 +2,7 @@ EXTENSION("uri", "php_uri.c php_uri_common.c uri_parser_rfc3986.c uri_parser_wha AC_DEFINE("URI_ENABLE_ANSI", 1, "Define to 1 for enabling ANSI support of uriparser.") AC_DEFINE("URI_NO_UNICODE", 1, "Define to 1 for disabling unicode support of uriparser.") -ADD_FLAG("CFLAGS_URI", "/D URI_STATIC_BUILD"); +ADD_FLAG("CFLAGS_URI", "/D URI_STATIC_BUILD /D LEXBOR_STATIC"); ADD_EXTENSION_DEP('uri', 'lexbor'); ADD_SOURCES("ext/uri/uriparser/src", "UriCommon.c UriCompare.c UriCopy.c UriEscape.c UriFile.c UriIp4.c UriIp4Base.c \