Skip to content

Commit 5b906ce

Browse files
committed
Fix bug #66509: copy() arginfo incorrect since 5.4
Since 5.4, the ZEND_BEGIN_ARG_INFO_EX was replaced by non _EX, causing Reflection to assume the $context parameter is required.
1 parent a218a8b commit 5b906ce

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ PHP NEWS
44

55
- Core:
66
. Fixed bug #66286 (Incorrect object comparison with inheritance). (Nikita)
7+
. Fixed bug #66509 (copy() arginfo has changed starting from 5.4). (willfitch)
78

89
- Session:
910
. Fixed bug #66481 (Calls to session_name() segfault when session.name is

ext/standard/basic_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ ZEND_END_ARG_INFO()
12061206
ZEND_BEGIN_ARG_INFO(arginfo_fstat, 0)
12071207
ZEND_ARG_INFO(0, fp)
12081208
ZEND_END_ARG_INFO()
1209-
ZEND_BEGIN_ARG_INFO(arginfo_copy, 0)
1209+
ZEND_BEGIN_ARG_INFO_EX(arginfo_copy, 0, 0, 2)
12101210
ZEND_ARG_INFO(0, source_file)
12111211
ZEND_ARG_INFO(0, destination_file)
12121212
ZEND_ARG_INFO(0, context)

ext/standard/tests/file/bug66509.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Bug #66509 (copy() showing $context parameter as required)
3+
--FILE--
4+
<?php
5+
6+
$r = new \ReflectionFunction('copy');
7+
8+
foreach($r->getParameters() as $p) {
9+
var_dump($p->isOptional());
10+
}
11+
?>
12+
--EXPECT--
13+
bool(false)
14+
bool(false)
15+
bool(true)

0 commit comments

Comments
 (0)