mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00

Not all extensions consistently throw exceptions when the user passes a path name containing null bytes. Also, some extensions would throw a ValueError while others would throw a TypeError. Error messages also varied. Now a ValueError is thrown after all failed path checks, at least for as far as these occur in functions that are exposed to userland. Closes GH-6216.
29 lines
781 B
PHP
29 lines
781 B
PHP
--TEST--
|
|
DOMDocument::saveHTMLFile() should fail with invalid filename
|
|
--CREDITS--
|
|
Knut Urdalen <knut@php.net>
|
|
#PHPTestFest2009 Norway 2009-06-09 \o/
|
|
--SKIPIF--
|
|
<?php
|
|
require_once __DIR__ .'/skipif.inc';
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$filename = null;
|
|
$doc = new DOMDocument('1.0');
|
|
$root = $doc->createElement('html');
|
|
$root = $doc->appendChild($root);
|
|
$head = $doc->createElement('head');
|
|
$head = $root->appendChild($head);
|
|
$title = $doc->createElement('title');
|
|
$title = $head->appendChild($title);
|
|
$text = $doc->createTextNode('This is the title');
|
|
$text = $title->appendChild($text);
|
|
try {
|
|
$doc->saveHTMLFile($filename);
|
|
} catch (ValueError $exception) {
|
|
echo $exception->getMessage() . "\n";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
DOMDocument::saveHTMLFile(): Argument #1 ($filename) must not be empty
|