Skip to content

Commit e8f217d

Browse files
nielsdossaundefined
authored andcommitted
Disable global state test on Windows
It looks like the config.w32 uses CHECK_HEADER_ADD_INCLUDE to add the include path to libxml into the search path. That doesn't happen in zend-test. To add to the Windows trouble, libxml is statically linked in, ext/libxml can only be built statically but ext/zend-test can be built both statically and dynamically. So the regression tests won't work in all possible configurations anyway on Windows. All of this is no problem on Linux because it just uses dynamic linking and pkg-config, without any magic. Signed-off-by: Ben Ramsey <ramsey@php.net> (cherry picked from commit 62228a2)
1 parent 8f14f03 commit e8f217d

6 files changed

+11
-3
lines changed

ext/dom/tests/libxml_global_state_entity_loader_bypass.phpt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ GHSA-3qrf-m4j2-pcrr (libxml global state entity loader bypass)
55
if (!extension_loaded('libxml')) die('skip libxml extension not available');
66
if (!extension_loaded('dom')) die('skip dom extension not available');
77
if (!extension_loaded('zend-test')) die('skip zend-test extension not available');
8+
if (!function_exists('zend_test_override_libxml_global_state')) die('skip not for Windows');
89
?>
910
--FILE--
1011
<?php

ext/simplexml/tests/libxml_global_state_entity_loader_bypass.phpt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ GHSA-3qrf-m4j2-pcrr (libxml global state entity loader bypass)
55
if (!extension_loaded('libxml')) die('skip libxml extension not available');
66
if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
77
if (!extension_loaded('zend-test')) die('skip zend-test extension not available');
8+
if (!function_exists('zend_test_override_libxml_global_state')) die('skip not for Windows');
89
?>
910
--FILE--
1011
<?php

ext/xmlreader/tests/libxml_global_state_entity_loader_bypass.phpt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ GHSA-3qrf-m4j2-pcrr (libxml global state entity loader bypass)
55
if (!extension_loaded('libxml')) die('skip libxml extension not available');
66
if (!extension_loaded('xmlreader')) die('skip xmlreader extension not available');
77
if (!extension_loaded('zend-test')) die('skip zend-test extension not available');
8+
if (!function_exists('zend_test_override_libxml_global_state')) die('skip not for Windows');
89
?>
910
--FILE--
1011
<?php

ext/zend_test/test.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "test.h"
3333
#include "test_arginfo.h"
3434

35-
#ifdef HAVE_LIBXML
35+
#if defined(HAVE_LIBXML) && !defined(PHP_WIN32)
3636
# include <libxml/globals.h>
3737
# include <libxml/parser.h>
3838
#endif
@@ -311,6 +311,7 @@ static ZEND_FUNCTION(zend_get_current_func_name)
311311
RETURN_STR(function_name);
312312
}
313313

314+
#if defined(HAVE_LIBXML) && !defined(PHP_WIN32)
314315
static ZEND_FUNCTION(zend_test_override_libxml_global_state)
315316
{
316317
ZEND_PARSE_PARAMETERS_NONE();
@@ -322,6 +323,7 @@ static ZEND_FUNCTION(zend_test_override_libxml_global_state)
322323
(void) xmlLineNumbersDefault(1);
323324
(void) xmlKeepBlanksDefault(0);
324325
}
326+
#endif
325327

326328
/* TESTS Z_PARAM_ITERABLE and Z_PARAM_ITERABLE_OR_NULL */
327329
static ZEND_FUNCTION(zend_iterable)

ext/zend_test/test.stub.php

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ function zend_get_map_ptr_last(): int {}
171171

172172
function zend_test_crash(?string $message = null): void {}
173173
#ifdef HAVE_LIBXML
174+
#if defined(HAVE_LIBXML) && !defined(PHP_WIN32)
174175
function zend_test_override_libxml_global_state(): void {}
175176
#endif
176177

ext/zend_test/test_arginfo.h

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)