mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
bd9f4fa676
For rationale, see https://github.com/php/php-src/pull/6787 Make extension checks lowercase, add a special case for opcache that has internal name not matching .so filename. Extensions migrated in part 2: * dom * exif * fileinfo * ffi
49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
--TEST--
|
|
DOMNode::C14NFile()
|
|
--EXTENSIONS--
|
|
dom
|
|
--FILE--
|
|
<?php
|
|
$xml = <<< XML
|
|
<?xml version="1.0" ?>
|
|
<books>
|
|
<book>
|
|
<title>The Grapes of Wrath</title>
|
|
<author>John Steinbeck</author>
|
|
</book>
|
|
<book>
|
|
<title>The Pearl</title>
|
|
<author>John Steinbeck</author>
|
|
</book>
|
|
</books>
|
|
XML;
|
|
|
|
$output = __DIR__.'/DOMNode_C14NFile_basic.tmp';
|
|
$doc = new DOMDocument();
|
|
$doc->loadXML($xml);
|
|
$node = $doc->getElementsByTagName('title')->item(0);
|
|
var_dump($node->C14NFile($output));
|
|
$content = file_get_contents($output);
|
|
var_dump($content);
|
|
try {
|
|
var_dump($node->C14NFile($output, false, false, []));
|
|
} catch (\ValueError $e) {
|
|
echo $e->getMessage() . \PHP_EOL;
|
|
}
|
|
try {
|
|
var_dump($node->C14NFile($output, false, false, ['query' => []]));
|
|
} catch (\TypeError $e) {
|
|
echo $e->getMessage() . \PHP_EOL;
|
|
}
|
|
?>
|
|
--CLEAN--
|
|
<?php
|
|
$output = __DIR__.'/DOMNode_C14NFile_basic.tmp';
|
|
unlink($output);
|
|
?>
|
|
--EXPECT--
|
|
int(34)
|
|
string(34) "<title>The Grapes of Wrath</title>"
|
|
DOMNode::C14NFile(): Argument #4 ($xpath) must have a "query" key
|
|
DOMNode::C14NFile(): Argument #4 ($xpath) "query" option must be a string, array given
|