bug79971_1.phpt 833 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Bug #79971 (special character is breaking the path in xml function)
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
  6. ?>
  7. --FILE--
  8. <?php
  9. if (PHP_OS_FAMILY === 'Windows') {
  10. $path = '/' . str_replace('\\', '/', __DIR__);
  11. } else {
  12. $path = __DIR__;
  13. }
  14. $uri = "file://$path/bug79971_1.xml";
  15. var_dump(simplexml_load_file("$uri%00foo"));
  16. $sxe = simplexml_load_file($uri);
  17. var_dump($sxe->asXML("$uri.out%00foo"));
  18. ?>
  19. --EXPECTF--
  20. Warning: simplexml_load_file(): URI must not contain percent-encoded NUL bytes in %s on line %d
  21. Warning: simplexml_load_file(): I/O warning : failed to load external entity "%s/bug79971_1.xml%%r00%rfoo" in %s on line %d
  22. bool(false)
  23. Warning: SimpleXMLElement::asXML(): URI must not contain percent-encoded NUL bytes in %s on line %d
  24. bool(false)