summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-02-09 12:28:28 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-02-09 12:28:28 +0100
commit3549f48edc914db041d81ae207400971d1c6c43c (patch)
tree5f9fd954f984cc67f936b18b3ad9a669b5f81d2f
parentab92ffee227137ed38ebe2ca8ce26e70da6aa810 (diff)
downloadphp-git-3549f48edc914db041d81ae207400971d1c6c43c.tar.gz
Make createDocument() $namespace nullable
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.
-rw-r--r--ext/dom/domimplementation.c2
-rw-r--r--ext/dom/php_dom.stub.php2
-rw-r--r--ext/dom/php_dom_arginfo.h4
-rw-r--r--ext/dom/tests/DOMImplementation_createDocument_basic.phpt1
4 files changed, 5 insertions, 4 deletions
diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c
index b195af5549..24b04f2b68 100644
--- a/ext/dom/domimplementation.c
+++ b/ext/dom/domimplementation.c
@@ -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();
}
diff --git a/ext/dom/php_dom.stub.php b/ext/dom/php_dom.stub.php
index b303caf93f..29e7a0ad80 100644
--- a/ext/dom/php_dom.stub.php
+++ b/ext/dom/php_dom.stub.php
@@ -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
diff --git a/ext/dom/php_dom_arginfo.h b/ext/dom/php_dom_arginfo.h
index 22944d296c..43ed756b29 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: 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()
diff --git a/ext/dom/tests/DOMImplementation_createDocument_basic.phpt b/ext/dom/tests/DOMImplementation_createDocument_basic.phpt
index e501cd29e3..23a8e04b24 100644
--- a/ext/dom/tests/DOMImplementation_createDocument_basic.phpt
+++ b/ext/dom/tests/DOMImplementation_createDocument_basic.phpt
@@ -6,6 +6,7 @@ include('skipif.inc');
?>
--FILE--
<?php
+declare(strict_types=1);
$x = new DOMImplementation();
$doc = $x->createDocument(null, 'html');
echo $doc->saveHTML();