com php-src: Fixed bug #74416 Wrong reflection on DOMNode::cloneNode: ext/dom/node.c ext/dom/tests/bug74416.phpt

[email protected] (Remi Collet)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    bc4bb7882b823ce13e760a0a910d62f0d825a8a4
Author:    Fabien Villepinte <[email protected]>         Tue, 11 Apr 2017 17:26:03 +0200
Committer: Remi Collet <[email protected]>      Thu, 13 Apr 2017 07:07:24 +0200
Parents:   f4a41fe7502d7659239e569bdac9a9c1edda13f2
Branches:  PHP-7.0 PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=bc4bb7882b823ce13e760a0a910d62f0d825a8a4

Log:
Fixed bug #74416 Wrong reflection on DOMNode::cloneNode

Bugs:
https://bugs.php.net/74416

Changed paths:
  M  ext/dom/node.c
  A  ext/dom/tests/bug74416.phpt


Diff:
diff --git a/ext/dom/node.c b/ext/dom/node.c
index 82879da..b4ab9f8 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -49,7 +49,7 @@ ZEND_END_ARG_INFO();
 ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_has_child_nodes, 0, 0, 0)
 ZEND_END_ARG_INFO();
 
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_clone_node, 0, 0, 1)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_clone_node, 0, 0, 0)
 	ZEND_ARG_INFO(0, deep)
 ZEND_END_ARG_INFO();
 
diff --git a/ext/dom/tests/bug74416.phpt b/ext/dom/tests/bug74416.phpt
new file mode 100644
index 0000000..d441c0a
--- /dev/null
+++ b/ext/dom/tests/bug74416.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #74416 Wrong reflection on DOMNode::cloneNode
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+if (!extension_loaded('reflection')) die('skip reflection extension not available');
+?>
+--FILE--
+<?php
+$rm = new ReflectionMethod(DOMNode::class, "cloneNode");
+printf("%d\n%d\n", $rm->getNumberOfParameters(), $rm->getNumberOfRequiredParameters());
+foreach ($rm->getParameters() as $param) {
+    printf("Parameter #%d %s OPTIONAL\n", $param->getPosition(), $param->isOptional() ? "IS" : "IS NOT");
+}
+?>
+===DONE===
+--EXPECT--
+1
+0
+Parameter #0 IS OPTIONAL
+===DONE===
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.