mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Make getElementsByTagNameNS $namespace nullable
According to the DOM specification, this argument is supposed to be nullable.
This commit is contained in:
parent
ff8da0dcff
commit
ab92ffee22
5 changed files with 20 additions and 12 deletions
|
@ -986,7 +986,7 @@ PHP_METHOD(DOMDocument, getElementsByTagNameNS)
|
||||||
xmlChar *local, *nsuri;
|
xmlChar *local, *nsuri;
|
||||||
|
|
||||||
id = ZEND_THIS;
|
id = ZEND_THIS;
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -995,7 +995,7 @@ PHP_METHOD(DOMDocument, getElementsByTagNameNS)
|
||||||
php_dom_create_iterator(return_value, DOM_NODELIST);
|
php_dom_create_iterator(return_value, DOM_NODELIST);
|
||||||
namednode = Z_DOMOBJ_P(return_value);
|
namednode = Z_DOMOBJ_P(return_value);
|
||||||
local = xmlCharStrndup(name, name_len);
|
local = xmlCharStrndup(name, name_len);
|
||||||
nsuri = xmlCharStrndup(uri, uri_len);
|
nsuri = xmlCharStrndup(uri ? uri : "", uri_len);
|
||||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
||||||
}
|
}
|
||||||
/* }}} end dom_document_get_elements_by_tag_name_ns */
|
/* }}} end dom_document_get_elements_by_tag_name_ns */
|
||||||
|
|
|
@ -933,7 +933,7 @@ PHP_METHOD(DOMElement, getElementsByTagNameNS)
|
||||||
xmlChar *local, *nsuri;
|
xmlChar *local, *nsuri;
|
||||||
|
|
||||||
id = ZEND_THIS;
|
id = ZEND_THIS;
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -942,7 +942,7 @@ PHP_METHOD(DOMElement, getElementsByTagNameNS)
|
||||||
php_dom_create_iterator(return_value, DOM_NODELIST);
|
php_dom_create_iterator(return_value, DOM_NODELIST);
|
||||||
namednode = Z_DOMOBJ_P(return_value);
|
namednode = Z_DOMOBJ_P(return_value);
|
||||||
local = xmlCharStrndup(name, name_len);
|
local = xmlCharStrndup(name, name_len);
|
||||||
nsuri = xmlCharStrndup(uri, uri_len);
|
nsuri = xmlCharStrndup(uri ? uri : "", uri_len);
|
||||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ class DOMElement implements DOMParentNode, DOMChildNode
|
||||||
public function getElementsByTagName(string $qualifiedName) {}
|
public function getElementsByTagName(string $qualifiedName) {}
|
||||||
|
|
||||||
/** @return DOMNodeList */
|
/** @return DOMNodeList */
|
||||||
public function getElementsByTagNameNS(string $namespace, string $localName) {}
|
public function getElementsByTagNameNS(?string $namespace, string $localName) {}
|
||||||
|
|
||||||
/** @return bool */
|
/** @return bool */
|
||||||
public function hasAttribute(string $qualifiedName) {}
|
public function hasAttribute(string $qualifiedName) {}
|
||||||
|
@ -287,7 +287,7 @@ class DOMDocument implements DOMParentNode
|
||||||
public function getElementsByTagName(string $qualifiedName) {}
|
public function getElementsByTagName(string $qualifiedName) {}
|
||||||
|
|
||||||
/** @return DOMNodeList */
|
/** @return DOMNodeList */
|
||||||
public function getElementsByTagNameNS(string $namespace, string $localName) {}
|
public function getElementsByTagNameNS(?string $namespace, string $localName) {}
|
||||||
|
|
||||||
/** @return DOMNode|false */
|
/** @return DOMNode|false */
|
||||||
public function importNode(DOMNode $node, bool $deep = false) {}
|
public function importNode(DOMNode $node, bool $deep = false) {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: 7cba1a7a34cc4789871faf44fc4794a48db26e61 */
|
* Stub hash: 72c2add8db9af8f90e84997a2a5ca6743268fae8 */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 1)
|
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)
|
ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0)
|
||||||
|
@ -184,10 +184,7 @@ ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
#define arginfo_class_DOMElement_getElementsByTagName arginfo_class_DOMElement_getAttribute
|
#define arginfo_class_DOMElement_getElementsByTagName arginfo_class_DOMElement_getAttribute
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_getElementsByTagNameNS, 0, 0, 2)
|
#define arginfo_class_DOMElement_getElementsByTagNameNS arginfo_class_DOMElement_getAttributeNS
|
||||||
ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0)
|
|
||||||
ZEND_ARG_TYPE_INFO(0, localName, IS_STRING, 0)
|
|
||||||
ZEND_END_ARG_INFO()
|
|
||||||
|
|
||||||
#define arginfo_class_DOMElement_hasAttribute arginfo_class_DOMElement_getAttribute
|
#define arginfo_class_DOMElement_hasAttribute arginfo_class_DOMElement_getAttribute
|
||||||
|
|
||||||
|
@ -292,7 +289,7 @@ ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
#define arginfo_class_DOMDocument_getElementsByTagName arginfo_class_DOMElement_getAttribute
|
#define arginfo_class_DOMDocument_getElementsByTagName arginfo_class_DOMElement_getAttribute
|
||||||
|
|
||||||
#define arginfo_class_DOMDocument_getElementsByTagNameNS arginfo_class_DOMElement_getElementsByTagNameNS
|
#define arginfo_class_DOMDocument_getElementsByTagNameNS arginfo_class_DOMElement_getAttributeNS
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_importNode, 0, 0, 1)
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_importNode, 0, 0, 1)
|
||||||
ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
|
ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
|
||||||
|
|
|
@ -6,13 +6,24 @@ require_once('skipif.inc');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
$doc->loadXML('<root xmlns:x="x"><a/><x:a/></root>');
|
$doc->loadXML('<root xmlns:x="x"><a/><x:a/></root>');
|
||||||
$list = $doc->getElementsByTagNameNS('', 'a');
|
$list = $doc->getElementsByTagNameNS('', 'a');
|
||||||
var_dump($list->length);
|
var_dump($list->length);
|
||||||
$list = $doc->getElementsByTagNameNS(null, 'a');
|
$list = $doc->getElementsByTagNameNS(null, 'a');
|
||||||
var_dump($list->length);
|
var_dump($list->length);
|
||||||
|
|
||||||
|
$elem = $doc->documentElement;
|
||||||
|
$list = $elem->getElementsByTagNameNS('', 'a');
|
||||||
|
var_dump($list->length);
|
||||||
|
$list = $elem->getElementsByTagNameNS(null, 'a');
|
||||||
|
var_dump($list->length);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
int(1)
|
int(1)
|
||||||
int(1)
|
int(1)
|
||||||
|
int(1)
|
||||||
|
int(1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue