]> granicus.if.org Git - php/commitdiff
Make createDocument() $namespace nullable
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 9 Feb 2021 11:28:28 +0000 (12:28 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 9 Feb 2021 11:28:28 +0000 (12:28 +0100)
According to the DOM specification, this argument should be
nullable. It's also supposed to be a required argument, but
not changing that at this point.

ext/dom/domimplementation.c
ext/dom/php_dom.stub.php
ext/dom/php_dom_arginfo.h
ext/dom/tests/DOMImplementation_createDocument_basic.phpt

index b195af5549c66e54e4b31279d4854b50bfb9851e..24b04f2b68f3495479e9e264460d466099f00a7c 100644 (file)
@@ -127,7 +127,7 @@ PHP_METHOD(DOMImplementation, createDocument)
        char *prefix = NULL, *localname = NULL;
        dom_object *doctobj;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ssO!", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!sO!", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
                RETURN_THROWS();
        }
 
index b303caf93ff6fcc637435fcce99dbbcdaadce0f1..29e7a0ad805932baae33ff54575221b5dd922f0c 100644 (file)
@@ -105,7 +105,7 @@ class DOMImplementation
     public function createDocumentType(string $qualifiedName, string $publicId = "", string $systemId = "") {}
 
     /** @return DOMDocument|false */
-    public function createDocument(string $namespace = "", string $qualifiedName = "", ?DOMDocumentType $doctype = null) {}
+    public function createDocument(?string $namespace = null, string $qualifiedName = "", ?DOMDocumentType $doctype = null) {}
 }
 
 class DOMDocumentFragment implements DOMParentNode
index 22944d296ca936877c4f3d9ab994a9bb6c6aa66c..43ed756b294ee43784021382708df08b56f8fabb 100644 (file)
@@ -1,5 +1,5 @@
 /* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 72c2add8db9af8f90e84997a2a5ca6743268fae8 */
+ * Stub hash: f4f6923a713a51d2944a21a123967343320be15c */
 
 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 1)
        ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0)
@@ -106,7 +106,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMImplementation_createDocumentType, 0, 0,
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMImplementation_createDocument, 0, 0, 0)
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, namespace, IS_STRING, 0, "\"\"")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, namespace, IS_STRING, 1, "null")
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, qualifiedName, IS_STRING, 0, "\"\"")
        ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, doctype, DOMDocumentType, 1, "null")
 ZEND_END_ARG_INFO()
index e501cd29e3d6e9165ad2191bbd426bcc08978465..23a8e04b241d84d3bb3474bcb30e218f8cc140c2 100644 (file)
@@ -6,6 +6,7 @@ include('skipif.inc');
 ?>
 --FILE--
 <?php
+declare(strict_types=1);
 $x = new DOMImplementation();
 $doc = $x->createDocument(null, 'html');
 echo $doc->saveHTML();