Skip to content

Commit cc0260e

Browse files
authored
Change return type of DOM\HTMLDocument::saveHTML() (#13701)
Strict error checking is always true for classes in "new DOM". This means that we always throw an error when calling `php_dom_throw_error`, and therefore the false return value is not actually possible. Also change the stub to reflect this.
1 parent 330cc5c commit cc0260e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

ext/dom/html_document.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,8 +1294,8 @@ PHP_METHOD(DOM_HTMLDocument, saveHTML)
12941294
if (nodep != NULL) {
12951295
DOM_GET_OBJ(node, nodep, xmlNodePtr, nodeobj);
12961296
if (node->doc != docp) {
1297-
php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document));
1298-
RETURN_FALSE;
1297+
php_dom_throw_error(WRONG_DOCUMENT_ERR, true);
1298+
RETURN_THROWS();
12991299
}
13001300
} else {
13011301
node = (const xmlNode *) docp;

ext/dom/php_dom.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ public function saveXML(?Node $node = null, int $options = 0): string|false {}
15991599
/** @implementation-alias DOMDocument::save */
16001600
public function saveXMLFile(string $filename, int $options = 0): int|false {}
16011601

1602-
public function saveHTML(?Node $node = null): string|false {}
1602+
public function saveHTML(?Node $node = null): string {}
16031603

16041604
public function saveHTMLFile(string $filename): int|false {}
16051605
}

ext/dom/php_dom_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)