Skip to content

Commit db6990a

Browse files
committed
Fix genarginfo to respect by-ref passing
1 parent 19fd124 commit db6990a

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

Zend/zend_builtin_functions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,8 @@ ZEND_FUNCTION(strncasecmp)
738738
}
739739
/* }}} */
740740

741-
/* {{{ proto array each(array arr)
742-
Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element */
741+
/* {{{ proto mixed each(array &arr)
742+
Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element, or false if there is no element at this place */
743743
ZEND_FUNCTION(each)
744744
{
745745
zval *array, *entry, tmp;

scripts/dev/genarginfo.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,21 @@
3838
echo "ZEND_BEGIN_ARG_INFO_EX(arginfo_{$name}, 0, 0, {$required})\n";
3939
}
4040
foreach($args as $arg) {
41-
list($type,$name) = explode(' ', $arg, 2);
42-
list($name,) = explode('|', $name, 2); // No |'s in the names - choose the first
41+
list($type, $name) = explode(' ', trim($arg), 2);
42+
list($name) = explode('|', trim($name), 2); // No |'s in the names - choose the first
43+
$name = trim($name);
44+
if ($ref = ($name[0] == "&")) {
45+
$name = trim(substr($name, 1));
46+
}
47+
list($name, $default) = explode("=", $name, 2);
48+
$name = trim($name);
49+
$allow_null = (int) (trim($default) == "null");
50+
$ref = (int) $ref;
4351
$type=trim($type);
4452
if(!empty($types[$type])) {
45-
echo "\tZEND_ARG_TYPE_INFO(0, {$name}, {$types[$type]}, 0)\n";
53+
echo "\tZEND_ARG_TYPE_INFO($ref, {$name}, {$types[$type]}, $allow_null)\n";
4654
} else {
47-
echo "\tZEND_ARG_INFO(0, {$name})\n";
55+
echo "\tZEND_ARG_INFO($ref, {$name})\n";
4856
}
4957
}
5058
echo "ZEND_END_ARG_INFO()\n\n";

0 commit comments

Comments
 (0)