com php-src: Fixed bug #74035: NEWS ext/reflection/php_reflec tion.c ext/reflection/tests/ReflectionClass_toString_ 001.phpt
ext/reflection/tests/bug74035.ph pt
| From: | Nikita Popov | Date: | Fri, 03 Feb 2017 17:29:39 +0000 |
| Subject: | com php-src: Fixed bug #74035: NEWS ext/reflection/php_reflec tion.c ext/reflection/tests/ReflectionClass_toString_ 001.phpt ext/reflection/tests/bug74035.ph pt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97006@lists.php.net to get a copy of this message | ||
Commit: 9ffc6ca62f53431a4b32b30cdda8180142f47cdb
Author: andrewnester <andrew.nester.dev@gmail.com> Fri, 3 Feb 2017 11:57:16 +0300
Committer: Nikita Popov <nikita.ppv@gmail.com> Fri, 3 Feb 2017 18:29:39 +0100
Parents: 6988d070ea8c7d44452d8c98e594d65ea722a1d8
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9ffc6ca62f53431a4b32b30cdda8180142f47cdb
Log:
Fixed bug #74035
Bugs:
https://bugs.php.net/74035
Changed paths:
M NEWS
M ext/reflection/php_reflection.c
M ext/reflection/tests/ReflectionClass_toString_001.phpt
A ext/reflection/tests/bug74035..phpt
Diff:
diff --git a/NEWS b/NEWS
index 095fb22..e2878e0 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,10 @@ PHP NEWS
. Fixed bug #74022 (PHP Fast CGI crashes when reading from a pfx file).
(Anatol)
+- Reflection:
+ . Fixed bug #74035 (getNumberOfRequiredParameters wrong for
+ ReflectionClass::newInstance). (Andrew Nester)
+
- Standard:
. Fixed bug #74005 (mail.add_x_header causes RFC-breaking lone line feed).
(Anatol)
diff --git a/ext/reflection/php_reflection..c b/ext/reflection/php_reflection.c
index 7d70326..7c21904 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -4586,7 +4586,7 @@ ZEND_METHOD(reflection_class, isInstance)
}
/* }}} */
-/* {{{ proto public stdclass ReflectionClass::newInstance(mixed* args, ...)
+/* {{{ proto public stdclass ReflectionClass::newInstance([mixed* args], ...)
Returns an instance of this class */
ZEND_METHOD(reflection_class, newInstance)
{
@@ -6273,8 +6273,8 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_isInstance, 0)
ZEND_ARG_INFO(0, object)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstance, 0)
- ZEND_ARG_INFO(0, args)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_newInstance, 0, 0, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstanceWithoutConstructor, 0)
diff --git a/ext/reflection/tests/ReflectionClass_toString_001.phpt
b/ext/reflection/tests/ReflectionClass_toString_001.phpt
index b9a9b0d..89b36fd 100644
--- a/ext/reflection/tests/ReflectionClass_toString_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt
@@ -252,7 +252,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ]
{
Method [ <internal:Reflection> public method newInstance ] {
- Parameters [1] {
- Parameter #0 [ <required> $args ]
+ Parameter #0 [ <optional> ...$args ]
}
}
diff --git a/ext/reflection/tests/bug74035.phpt b/ext/reflection/tests/bug74035.phpt
new file mode 100644
index 0000000..74cf03f
--- /dev/null
+++ b/ext/reflection/tests/bug74035.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #74035: getNumberOfRequiredParameters wrong for ReflectionClass::newInstance
+--FILE--
+<?php
+$r = new ReflectionClass(ReflectionClass::class);
+$m = $r->getMethod('newInstance');
+
+echo $m->getNumberOfRequiredParameters();
+?>
+--EXPECT--
+0