mirror of
https://github.com/php/php-src.git
synced 2026-04-03 22:22:18 +02:00
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>
37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
--TEST--
|
|
GHSA-3qrf-m4j2-pcrr (libxml global state entity loader bypass)
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('libxml')) die('skip libxml extension not available');
|
|
if (!extension_loaded('xmlreader')) die('skip xmlreader extension not available');
|
|
if (!extension_loaded('zend-test')) die('skip zend-test extension not available');
|
|
if (!function_exists('zend_test_override_libxml_global_state')) die('skip not for Windows');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$xml = "<?xml version='1.0'?><!DOCTYPE root [<!ENTITY % bork SYSTEM \"php://nope\"> %bork;]><nothing/>";
|
|
|
|
libxml_use_internal_errors(true);
|
|
zend_test_override_libxml_global_state();
|
|
|
|
echo "--- String test ---\n";
|
|
$reader = XMLReader::xml($xml);
|
|
$reader->read();
|
|
echo "--- File test ---\n";
|
|
file_put_contents("libxml_global_state_entity_loader_bypass.tmp", $xml);
|
|
$reader = XMLReader::open("libxml_global_state_entity_loader_bypass.tmp");
|
|
$reader->read();
|
|
|
|
echo "Done\n";
|
|
|
|
?>
|
|
--CLEAN--
|
|
<?php
|
|
@unlink("libxml_global_state_entity_loader_bypass.tmp");
|
|
?>
|
|
--EXPECT--
|
|
--- String test ---
|
|
--- File test ---
|
|
Done
|