]> granicus.if.org Git - php/commitdiff
Fix genarginfo to respect by-ref passing
authorBob Weinand <bobwei9@hotmail.com>
Mon, 22 Jun 2015 08:17:35 +0000 (10:17 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Mon, 22 Jun 2015 08:17:35 +0000 (10:17 +0200)
Zend/zend_builtin_functions.c
scripts/dev/genarginfo.php

index 98970e252a3e46e3d25c46be76b23c40686e51aa..08e78fdc335e850014fc5e9a67fab337e5776811 100644 (file)
@@ -738,8 +738,8 @@ ZEND_FUNCTION(strncasecmp)
 }
 /* }}} */
 
-/* {{{ proto array each(array arr)
-   Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element */
+/* {{{ proto mixed each(array &arr)
+   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 */
 ZEND_FUNCTION(each)
 {
        zval *array, *entry, tmp;
index de69f5b0450e8d167428afc5c27da6d06351d39f..94c10f8f83ddee0733c355777de819714a2b330a 100644 (file)
@@ -38,13 +38,21 @@ if($m) {
             echo "ZEND_BEGIN_ARG_INFO_EX(arginfo_{$name}, 0, 0, {$required})\n";
         }
         foreach($args as $arg) {
-            list($type,$name) = explode(' ', $arg, 2);
-            list($name,) = explode('|', $name, 2); // No |'s in the names - choose the first
+            list($type, $name) = explode(' ', trim($arg), 2);
+            list($name) = explode('|', trim($name), 2); // No |'s in the names - choose the first
+            $name = trim($name);
+            if ($ref = ($name[0] == "&")) {
+                $name = trim(substr($name, 1));
+            }
+            list($name, $default) = explode("=", $name, 2);
+            $name = trim($name);
+            $allow_null = (int) (trim($default) == "null");
+            $ref = (int) $ref;
             $type=trim($type);
             if(!empty($types[$type])) {
-                echo "\tZEND_ARG_TYPE_INFO(0, {$name}, {$types[$type]}, 0)\n";
+                echo "\tZEND_ARG_TYPE_INFO($ref, {$name}, {$types[$type]}, $allow_null)\n";
             } else {
-                echo "\tZEND_ARG_INFO(0, {$name})\n";
+                echo "\tZEND_ARG_INFO($ref, {$name})\n";
             }
         }
         echo "ZEND_END_ARG_INFO()\n\n";