1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

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.
This commit is contained in:
Niels Dossche
2024-03-13 21:49:40 +01:00
committed by GitHub
parent 330cc5cdb2
commit cc0260e014
3 changed files with 5 additions and 5 deletions

View File

@@ -1294,8 +1294,8 @@ PHP_METHOD(DOM_HTMLDocument, saveHTML)
if (nodep != NULL) {
DOM_GET_OBJ(node, nodep, xmlNodePtr, nodeobj);
if (node->doc != docp) {
php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document));
RETURN_FALSE;
php_dom_throw_error(WRONG_DOCUMENT_ERR, true);
RETURN_THROWS();
}
} else {
node = (const xmlNode *) docp;

View File

@@ -1599,7 +1599,7 @@ namespace DOM
/** @implementation-alias DOMDocument::save */
public function saveXMLFile(string $filename, int $options = 0): int|false {}
public function saveHTML(?Node $node = null): string|false {}
public function saveHTML(?Node $node = null): string {}
public function saveHTMLFile(string $filename): int|false {}
}

View File

@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: bca273cb7255e24536575922505d3cce7488b32d */
* Stub hash: 59b592b969e62100af3e3d73212cf513ab8d3ab8 */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 0)
ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0)
@@ -1007,7 +1007,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_DOM_HTMLDocument_saveXMLFi
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_DOM_HTMLDocument_saveHTML, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_DOM_HTMLDocument_saveHTML, 0, 0, IS_STRING, 0)
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, node, DOM\\\116ode, 1, "null")
ZEND_END_ARG_INFO()