Skip to content

Commit

Permalink
Fixed bug #74035
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnester authored and nikic committed Feb 3, 2017
1 parent 6988d07 commit 9ffc6ca
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions NEWS
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions ext/reflection/php_reflection.c
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ext/reflection/tests/ReflectionClass_toString_001.phpt
Expand Up @@ -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 ]
}
}

Expand Down
11 changes: 11 additions & 0 deletions 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

0 comments on commit 9ffc6ca

Please sign in to comment.