Skip to content

Commit f3028b9

Browse files
committed
- Improved fix for bug #52573
1 parent 9c0439e commit f3028b9

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Zend/zend_compile.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2922,7 +2922,8 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
29222922
return 0;
29232923
}
29242924

2925-
if (proto->common.pass_rest_by_reference
2925+
if (fe->common.type != ZEND_USER_FUNCTION
2926+
&& proto->common.pass_rest_by_reference
29262927
&& !fe->common.pass_rest_by_reference) {
29272928
return 0;
29282929
}

ext/spl/spl_directory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2586,7 +2586,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fgetss, 0, 0, 0)
25862586
ZEND_ARG_INFO(0, allowable_tags)
25872587
ZEND_END_ARG_INFO()
25882588

2589-
ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1)
2589+
ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 1, 0, 1)
25902590
ZEND_ARG_INFO(0, format)
25912591
ZEND_END_ARG_INFO()
25922592

ext/spl/tests/bug52573.phpt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
--TEST--
22
Bug #52573 (SplFileObject::fscanf Segmentation fault)
33
--FILE--
4-
<?php
4+
<?php // test
55

66
$result = null;
77
$f = new SplFileObject(__FILE__, 'r');
8-
$f->fscanf('<?php // %s', $result);
9-
8+
var_dump($f->fscanf('<?php // %s', $result));
9+
var_dump($result);
10+
var_dump($f->fscanf('<?php // %s'));
1011
?>
1112
--EXPECTF--
12-
Warning: Parameter 3 to fscanf() expected to be a reference, value given in %s on line 5
13+
int(1)
14+
string(4) "test"
15+
array(1) {
16+
[0]=>
17+
NULL
18+
}

0 commit comments

Comments
 (0)