[php-src] master: Change return type of DOM\HTMLDocument::saveHTML() (#13701)

From: Date: Wed, 13 Mar 2024 21:03:28 +0000
Subject: [php-src] master: Change return type of DOM\HTMLDocument::saveHTML() (#13701)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-127727@lists.php.net to get a copy of this message
Author: Niels Dossche (nielsdos) Committer: GitHub (web-flow) Pusher: nielsdos Date: 2024-03-13T21:49:40+01:00 Commit: https://github.com/php/php-src/commit/cc0260e0140f42fb98a4da52e0fbc715de6c5cad Raw diff: https://github.com/php/php-src/commit/cc0260e0140f42fb98a4da52e0fbc715de6c5cad.diff 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. Changed paths: M ext/dom/html_document.c M ext/dom/php_dom.stub.php M ext/dom/php_dom_arginfo.h Diff: diff --git a/ext/dom/html_document.c b/ext/dom/html_document.c index 1a05280f2c78..416def89b6a5 100644 --- a/ext/dom/html_document.c +++ b/ext/dom/html_document.c @@ -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; diff --git a/ext/dom/php_dom.stub.php b/ext/dom/php_dom.stub.php index 7f3a928a093a..bb72a3586fb8 100644 --- a/ext/dom/php_dom.stub.php +++ b/ext/dom/php_dom.stub.php @@ -1599,7 +1599,7 @@ public function saveXML(?Node $node = null, int $options = 0): string|false {} /** @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 {} } diff --git a/ext/dom/php_dom_arginfo.h b/ext/dom/php_dom_arginfo.h index 280b32e6152f..257f63004958 100644 --- a/ext/dom/php_dom_arginfo.h +++ b/ext/dom/php_dom_arginfo.h @@ -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()

« previous php.cvs (#127727) next »