]> granicus.if.org Git - php/commitdiff
- Fixed bug #43512 (same parameter name can be used multiple times in method/function...
authorFelipe Pena <felipe@php.net>
Thu, 17 Feb 2011 23:24:50 +0000 (23:24 +0000)
committerFelipe Pena <felipe@php.net>
Thu, 17 Feb 2011 23:24:50 +0000 (23:24 +0000)
NEWS
Zend/tests/bug54013.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/NEWS b/NEWS
index 46c752665cbfeaf93f59f2006b89369ef54f215d..ce807753b0247cf73e1e014ca6d448d161d0304d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,9 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2011, PHP 5.3.6
+- Zend Engine:
+  . Fixed bug #43512 (same parameter name can be used multiple times in
+    method/function definition). (Felipe)
 
 17 Feb 2011, PHP 5.3.6RC1
 - Upgraded bundled Sqlite3 to version 3.7.4. (Ilia)
diff --git a/Zend/tests/bug54013.phpt b/Zend/tests/bug54013.phpt
new file mode 100644 (file)
index 0000000..4219eed
--- /dev/null
@@ -0,0 +1,31 @@
+--TEST--
+Bug #54013 (ReflectionParam for duplicate parameter contains garbage)
+--FILE--
+<?php
+
+class a
+{
+        function b($aaaaaaaa, $aaaaaaaa)
+        {
+                $params = func_get_args();
+        }
+}
+
+$c = new a;
+$c->b('waa?', 'meukee!');
+
+$reflectionClass = new ReflectionClass($c);
+$params = $reflectionClass->getMethod('b')->getParameters();
+
+var_dump($params[0], $params[1]);
+
+?>
+--EXPECTF--
+object(ReflectionParameter)#%d (1) {
+  ["name"]=>
+  string(8) "aaaaaaaa"
+}
+object(ReflectionParameter)#%d (1) {
+  ["name"]=>
+  string(8) "aaaaaaaa"
+}
index 278844a422d0d63d508804ed4f74dde4f9b5494f..42a890ef857c8acf751ec84ab9af83fb9833829e 100644 (file)
@@ -387,6 +387,7 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar
                        result->op_type = IS_CV;
                        result->u.var = lookup_cv(CG(active_op_array), varname->u.constant.value.str.val, varname->u.constant.value.str.len);
                        result->u.EA.type = 0;
+                       varname->u.constant.value.str.val = CG(active_op_array)->vars[result->u.var].name;
                        return;
                }
        }