Skip to content

Commit 9ffc6ca

Browse files
andrewnesternikic
authored andcommitted
Fixed bug #74035
1 parent 6988d07 commit 9ffc6ca

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ PHP NEWS
2020
. Fixed bug #74022 (PHP Fast CGI crashes when reading from a pfx file).
2121
(Anatol)
2222

23+
- Reflection:
24+
. Fixed bug #74035 (getNumberOfRequiredParameters wrong for
25+
ReflectionClass::newInstance). (Andrew Nester)
26+
2327
- Standard:
2428
. Fixed bug #74005 (mail.add_x_header causes RFC-breaking lone line feed).
2529
(Anatol)

ext/reflection/php_reflection.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4586,7 +4586,7 @@ ZEND_METHOD(reflection_class, isInstance)
45864586
}
45874587
/* }}} */
45884588

4589-
/* {{{ proto public stdclass ReflectionClass::newInstance(mixed* args, ...)
4589+
/* {{{ proto public stdclass ReflectionClass::newInstance([mixed* args], ...)
45904590
Returns an instance of this class */
45914591
ZEND_METHOD(reflection_class, newInstance)
45924592
{
@@ -6273,8 +6273,8 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_isInstance, 0)
62736273
ZEND_ARG_INFO(0, object)
62746274
ZEND_END_ARG_INFO()
62756275

6276-
ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstance, 0)
6277-
ZEND_ARG_INFO(0, args)
6276+
ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_newInstance, 0, 0, 0)
6277+
ZEND_ARG_VARIADIC_INFO(0, args)
62786278
ZEND_END_ARG_INFO()
62796279

62806280
ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstanceWithoutConstructor, 0)

ext/reflection/tests/ReflectionClass_toString_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
252252
Method [ <internal:Reflection> public method newInstance ] {
253253

254254
- Parameters [1] {
255-
Parameter #0 [ <required> $args ]
255+
Parameter #0 [ <optional> ...$args ]
256256
}
257257
}
258258

ext/reflection/tests/bug74035.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Bug #74035: getNumberOfRequiredParameters wrong for ReflectionClass::newInstance
3+
--FILE--
4+
<?php
5+
$r = new ReflectionClass(ReflectionClass::class);
6+
$m = $r->getMethod('newInstance');
7+
8+
echo $m->getNumberOfRequiredParameters();
9+
?>
10+
--EXPECT--
11+
0

0 commit comments

Comments
 (0)