Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ext/dom/tests/DOM4_ChildNode_wrong_document.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function test($method) {
$element->$method($dom2->documentElement->firstChild);
echo "FAIL";
} catch (DOMException $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
}

Expand All @@ -29,6 +29,6 @@ test("replaceWith");

?>
--EXPECT--
Wrong Document Error
Wrong Document Error
Wrong Document Error
DOMException: Wrong Document Error
DOMException: Wrong Document Error
DOMException: Wrong Document Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOM4_DOMNode_removeDanglingElement.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ $element = $dom->createElement('test');
try {
$element->remove();
} catch (DOMException $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
Not Found Error
DOMException: Not Found Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOM4_ParentNode_append_invalidtypes.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ $dom->loadXML('<test />');
try {
$dom->documentElement->append(array());
} catch(TypeError $e) {
echo "OK! {$e->getMessage()}";
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
OK! DOMElement::append(): Argument #1 must be of type DOMNode|string, array given
TypeError: DOMElement::append(): Argument #1 must be of type DOMNode|string, array given
4 changes: 2 additions & 2 deletions ext/dom/tests/DOM4_ParentNode_append_with_attributes.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ $element = $dom->documentElement;
try {
$element->append($replacement, $addition);
} catch (DOMException $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

echo $dom->saveXML();
?>
--EXPECT--
Hierarchy Request Error
DOMException: Hierarchy Request Error
<?xml version="1.0"?>
<test attr-one="21"/>
6 changes: 3 additions & 3 deletions ext/dom/tests/DOM4_ParentNode_append_wrong_document.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ function test($method) {
$element->$method($dom2->documentElement->firstChild);
echo "FAIL";
} catch (DOMException $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
}

test("append");
test("prepend");
?>
--EXPECT--
Wrong Document Error
Wrong Document Error
DOMException: Wrong Document Error
DOMException: Wrong Document Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMAttr_construct_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ dom
try {
$attr = new DOMAttr();
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
DOMAttr::__construct() expects at least 1 argument, 0 given
ArgumentCountError: DOMAttr::__construct() expects at least 1 argument, 0 given
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMCDATASection_construct_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ dom
try {
$section = new DOMCDataSection();
} catch (TypeError $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
DOMCdataSection::__construct() expects exactly 1 argument, 0 given
ArgumentCountError: DOMCdataSection::__construct() expects exactly 1 argument, 0 given
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMCharacterData_data_error_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ $character_data = new DOMCharacterData();
try {
print $character_data->data;
} catch (DOMException $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
Invalid State Error
DOMException: Invalid State Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ $root->appendChild($cdata);
try {
$cdata->deleteData(5, 1);
} catch (DOMException $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
Index Size Error
DOMException: Index Size Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMCharacterData_length_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ $character_data = new DOMCharacterData();
try {
print $character_data->length;
} catch (DOMException $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
Invalid State Error
DOMException: Invalid State Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMComment_construct_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ dom
try {
$comment = new DOMComment("comment1", "comment2");
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
DOMComment::__construct() expects at most 1 argument, 2 given
ArgumentCountError: DOMComment::__construct() expects at most 1 argument, 2 given
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ $fragment = new DOMDocumentFragment();
try {
$fragment->appendXML('<bait>crankbait</bait>');
} catch (DOMException $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
No Modification Allowed Error
DOMException: No Modification Allowed Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ dom
try {
$fragment = new DOMDocumentFragment("root");
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
DOMDocumentFragment::__construct() expects exactly 0 arguments, 1 given
ArgumentCountError: DOMDocumentFragment::__construct() expects exactly 0 arguments, 1 given
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocumentType_entities_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$doctype->entities;
} catch (DOMException $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
Invalid State Error
DOMException: Invalid State Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocumentType_internalSubset_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$doctype->internalSubset;
} catch (DOMException $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
Invalid State Error
DOMException: Invalid State Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocumentType_name_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$doctype->name;
} catch (DOMException $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
Invalid State Error
DOMException: Invalid State Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocumentType_notations_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$notations = $doctype->notations;
} catch (DOMException $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
Invalid State Error
DOMException: Invalid State Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocumentType_publicId_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$publicId = $doctype->publicId;
} catch (DOMException $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
Invalid State Error
DOMException: Invalid State Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocumentType_systemId_error_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ $doctype = new DOMDocumentType();
try {
$systemId = $doctype->systemId;
} catch (DOMException $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
Invalid State Error
DOMException: Invalid State Error
10 changes: 5 additions & 5 deletions ext/dom/tests/DOMDocument_adoptNode.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo "-- Trying to append child from other document --\n";
try {
$doc2->firstChild->appendChild($b_tag_element); // Should fail because it's another document
} catch (\DOMException $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

echo "-- Adopting --\n";
Expand All @@ -48,7 +48,7 @@ echo "-- Adopt a document (strict error on) --\n";
try {
$doc1->adoptNode($doc1);
} catch (\DOMException $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

echo "-- Adopt a document (strict error off) --\n";
Expand All @@ -57,7 +57,7 @@ $doc1->strictErrorChecking = false;
try {
$doc1->adoptNode($doc1);
} catch (\DOMException $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
$doc1->strictErrorChecking = true;

Expand Down Expand Up @@ -117,7 +117,7 @@ var_dump($child->nodeName);
bool(true)
bool(false)
-- Trying to append child from other document --
Wrong Document Error
DOMException: Wrong Document Error
-- Adopting --
string(3) "hix"
string(35) "<?xml version="1.0"?>
Expand All @@ -138,7 +138,7 @@ string(27) "<?xml version="1.0"?>
<p/>
"
-- Adopt a document (strict error on) --
Not Supported Error
DOMException: Not Supported Error
-- Adopt a document (strict error off) --

Warning: DOMDocument::adoptNode(): Not Supported Error in %s on line %d
Expand Down
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocument_createEntityReference_error1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ try {
$objDoc->createEntityReference('!');
} catch (DOMException $e) {
var_dump($e->getCode() === DOM_INVALID_CHARACTER_ERR);
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
bool(true)
Invalid Character Error
DOMException: Invalid Character Error
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocument_encoding_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ try {
$ret = $dom->encoding = 'NYPHP DOMinatrix';
echo "Adding invalid encoding: $ret\n";
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}

$ret = $dom->encoding = 'ISO-8859-1';
Expand All @@ -44,7 +44,7 @@ echo "UTF-16 Encoding Read: {$dom->encoding}\n";
?>
--EXPECT--
Empty Encoding Read: ''
Invalid document encoding
ValueError: Invalid document encoding
Adding ISO-8859-1 encoding: ISO-8859-1
ISO-8859-1 Encoding Read: ISO-8859-1
Adding UTF-8 encoding: UTF-8
Expand Down
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocument_loadHTML_error2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ $doc = new DOMDocument();
try {
$doc->loadHTML('');
} catch (ValueError $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
DOMDocument::loadHTML(): Argument #1 ($source) must not be empty
ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty
8 changes: 4 additions & 4 deletions ext/dom/tests/DOMDocument_loadHTMLfile_error2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ $doc = new DOMDocument();
try {
$result = $doc->loadHTMLFile("");
} catch (ValueError $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

$doc = new DOMDocument();
try {
$result = $doc->loadHTMLFile("text.html\0something");
} catch (ValueError $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not be empty
DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not contain any null bytes
ValueError: DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not be empty
ValueError: DOMDocument::loadHTMLFile(): Argument #1 ($filename) must not contain any null bytes
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocument_loadXML_error6.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ $dom = new DOMDocument();
try {
$dom->loadXML("");
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
DOMDocument::loadXML(): Argument #1 ($source) must not be empty
ValueError: DOMDocument::loadXML(): Argument #1 ($source) must not be empty
8 changes: 4 additions & 4 deletions ext/dom/tests/DOMDocument_load_error6.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ $dom = new DOMDocument();
try {
$dom->load("");
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}

try {
$dom->load("/path/with/\0/byte");
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}

// Path is too long
var_dump($dom->load(str_repeat(" ", PHP_MAXPATHLEN + 1)));
?>
--EXPECT--
DOMDocument::load(): Argument #1 ($filename) must not be empty
DOMDocument::load(): Argument #1 ($filename) must not contain any null bytes
ValueError: DOMDocument::load(): Argument #1 ($filename) must not be empty
ValueError: DOMDocument::load(): Argument #1 ($filename) must not contain any null bytes
bool(false)
4 changes: 2 additions & 2 deletions ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ dom
try {
DOMDocument::saveHTMLFile();
} catch (Error $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
Non-static method DOMDocument::saveHTMLFile() cannot be called statically
Error: Non-static method DOMDocument::saveHTMLFile() cannot be called statically
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ $text = $title->appendChild($text);
try {
$doc->saveHTMLFile($filename);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
DOMDocument::saveHTMLFile(): Argument #1 ($filename) must not be empty
ValueError: DOMDocument::saveHTMLFile(): Argument #1 ($filename) must not be empty
Loading
Loading