Skip to content

Commit 3549f48

Browse files
committed
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.
1 parent ab92ffe commit 3549f48

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

ext/dom/domimplementation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ PHP_METHOD(DOMImplementation, createDocument)
127127
char *prefix = NULL, *localname = NULL;
128128
dom_object *doctobj;
129129

130-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ssO!", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
130+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!sO!", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
131131
RETURN_THROWS();
132132
}
133133

ext/dom/php_dom.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function hasFeature(string $feature, string $version) {}
105105
public function createDocumentType(string $qualifiedName, string $publicId = "", string $systemId = "") {}
106106

107107
/** @return DOMDocument|false */
108-
public function createDocument(string $namespace = "", string $qualifiedName = "", ?DOMDocumentType $doctype = null) {}
108+
public function createDocument(?string $namespace = null, string $qualifiedName = "", ?DOMDocumentType $doctype = null) {}
109109
}
110110

111111
class DOMDocumentFragment implements DOMParentNode

ext/dom/php_dom_arginfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 72c2add8db9af8f90e84997a2a5ca6743268fae8 */
2+
* Stub hash: f4f6923a713a51d2944a21a123967343320be15c */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 1)
55
ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0)
@@ -106,7 +106,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMImplementation_createDocumentType, 0, 0,
106106
ZEND_END_ARG_INFO()
107107

108108
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMImplementation_createDocument, 0, 0, 0)
109-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, namespace, IS_STRING, 0, "\"\"")
109+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, namespace, IS_STRING, 1, "null")
110110
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, qualifiedName, IS_STRING, 0, "\"\"")
111111
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, doctype, DOMDocumentType, 1, "null")
112112
ZEND_END_ARG_INFO()

ext/dom/tests/DOMImplementation_createDocument_basic.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ include('skipif.inc');
66
?>
77
--FILE--
88
<?php
9+
declare(strict_types=1);
910
$x = new DOMImplementation();
1011
$doc = $x->createDocument(null, 'html');
1112
echo $doc->saveHTML();

0 commit comments

Comments
 (0)