forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-7.3: Fix #79971: special character is breaking the path in xml function
- Loading branch information
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
Bug #79971 (special character is breaking the path in xml function) | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('dom')) die('skip dom extension not available'); | ||
?> | ||
--FILE-- | ||
<?php | ||
$imp = new DOMImplementation; | ||
if (PHP_OS_FAMILY === 'Windows') { | ||
$path = '/' . str_replace('\\', '/', __DIR__); | ||
} else { | ||
$path = __DIR__; | ||
} | ||
$uri = "file://$path/bug79971_2.xml"; | ||
var_dump($imp->createDocumentType("$uri%00foo")); | ||
?> | ||
--EXPECTF-- | ||
Warning: DOMImplementation::createDocumentType(): URI must not contain percent-encoded NUL bytes in %s on line %d | ||
bool(false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
Bug #79971 (special character is breaking the path in xml function) | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('simplexml')) die('skip simplexml extension not available'); | ||
?> | ||
--FILE-- | ||
<?php | ||
if (PHP_OS_FAMILY === 'Windows') { | ||
$path = '/' . str_replace('\\', '/', __DIR__); | ||
} else { | ||
$path = __DIR__; | ||
} | ||
$uri = "file://$path/bug79971_1.xml"; | ||
var_dump(simplexml_load_file("$uri%00foo")); | ||
|
||
$sxe = simplexml_load_file($uri); | ||
var_dump($sxe->asXML("$uri.out%00foo")); | ||
?> | ||
--EXPECTF-- | ||
Warning: simplexml_load_file(): URI must not contain percent-encoded NUL bytes in %s on line %d | ||
|
||
Warning: simplexml_load_file(): I/O warning : failed to load external entity "%s/bug79971_1.xml%00foo" in %s on line %d | ||
bool(false) | ||
|
||
Warning: SimpleXMLElement::asXML(): URI must not contain percent-encoded NUL bytes in %s on line %d | ||
bool(false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0"?> | ||
<root></root> |