php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43512 same parameter name can be used multiple times in method/function definition
Submitted: 2007-12-06 09:08 UTC Modified: 2011-02-18 00:25 UTC
Votes:9
Avg. Score:4.6 ± 1.0
Reproduced:7 of 8 (87.5%)
Same Version:2 (28.6%)
Same OS:2 (28.6%)
From: alkoholex at gmail dot com Assigned: felipe
Status: Closed Package: Scripting Engine problem
PHP Version: * OS: *
Private report: No CVE-ID:
 [2007-12-06 09:08 UTC] alkoholex at gmail dot com
Description:
------------
The PHP-Parser doesn't recognise if a parameter with the same name is given over two times (no warning / error). In this case it was a copy-paste mistake, but it causes big troubles in our system.

Reproduce code:
---------------
class myCls extends otherCls {

     private function myFunc($var, $var) {
	//do something		
     }
}

Expected result:
----------------
A Warning should occur. Something like "Multible use of variable/parameter name in function myFunc".

Actual result:
--------------
Nothing. The second parameter replaces the value of the first.
If you don't give over an second parameter, the value of the first is nonsence or empty.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-12 10:28 UTC] jani@php.net
Good catch. I can reproduce this with any current CVS/released versions.
 [2010-12-31 23:54 UTC] jani@php.net
-Type: Feature/Change Request +Type: Bug -Package: Feature/Change Request +Package: Scripting Engine problem -Operating System: Linux Debian 4.0 +Operating System: * -PHP Version: 5.2.5, 5.3CVS, 6CVS +PHP Version: *
 [2011-02-18 00:24 UTC] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=308443
Log: - Fixed bug #43512 (same parameter name can be used multiple times in method/function definition)
 [2011-02-18 00:25 UTC] felipe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: felipe
 [2011-02-18 00:25 UTC] felipe@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Mon Apr 21 00:02:04 2014 UTC