Skip to content

Commit

Permalink
Merge branch 'PHP-8.4'
Browse files Browse the repository at this point in the history
* PHP-8.4:
  Updates for libxml2 >= 2.13.0
  • Loading branch information
cmb69 committed Oct 21, 2024
2 parents 4214d78 + 30dd291 commit 6dd67bb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ext/dom/tests/dom004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ in_array('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrap
--FILE--
<?php
$dom = new domdocument;
$dom->load("compress.zlib://".__DIR__."/book.xml.gz");
$dom->load("compress.zlib://" . str_replace("\\", "/", __DIR__) . "/book.xml.gz");
print $dom->saveXML();
?>
--EXPECT--
Expand Down
5 changes: 3 additions & 2 deletions ext/libxml/libxml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 2 additions & 3 deletions ext/libxml/tests/bug69753-mb.phpt
Original file line number Diff line number Diff line change
@@ -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--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only");
if (version_compare(LIBXML_DOTTED_VERSION, "2.13.0") < 0) die("skip fails for libxml2 < 2.13.0; https://gitlab.gnome.org/GNOME/libxml2/-/issues/611");
?>
--FILE--
<?php
Expand All @@ -17,4 +16,4 @@ $error = libxml_get_last_error();
var_dump($error->file);
?>
--EXPECTF--
string(%d) "file:///%s/ext/libxml/tests/bug69753.xml"
string(%d) "%s\ext\libxml\tests\bug69753私はガラスを食べられます.xml"
5 changes: 2 additions & 3 deletions ext/libxml/tests/bug69753.phpt
Original file line number Diff line number Diff line change
@@ -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--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only");
if (version_compare(LIBXML_DOTTED_VERSION, "2.13.0") < 0) die("skip fails for libxml2 < 2.13.0; https://gitlab.gnome.org/GNOME/libxml2/-/issues/611");
?>
--FILE--
<?php
Expand All @@ -17,4 +16,4 @@ $error = libxml_get_last_error();
var_dump($error->file);
?>
--EXPECTF--
string(%d) "file:///%s/ext/libxml/tests/bug69753.xml"
string(%d) "%s\ext\libxml\tests\bug69753.xml"

0 comments on commit 6dd67bb

Please sign in to comment.