php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54310 Class Method & Function Arguments are allowed to be named the same
Submitted: 2011-03-19 03:59 UTC Modified: 2015-03-29 08:03 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: nicholas dot j dot miller at gmail dot com Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.6 OS: ANY
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nicholas dot j dot miller at gmail dot com
New email:
PHP Version: OS:

 

 [2011-03-19 03:59 UTC] nicholas dot j dot miller at gmail dot com
Description:
------------
When writing class method and function declarations, php allows multiple 
parameters with the same name. This seems like something that should produce a 
warning or notice.

Test script:
---------------
class Foo
{
    public function bar($param, $param) {
       echo $param;
    }
}


$foo = new Foo();
$foo->bar('param1', 'param2');

Expected result:
----------------
I feel as though this should produce a warning or notice.

Actual result:
--------------
Runs without any issues and echos 'param2'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-22 13:16 UTC] jinmoku at hotmail dot com
see 
http://bugs.php.net/bug.php?id=43512
 [2011-03-22 13:23 UTC] felipe@php.net
What has been treated in bug #43512 was a memory issue. And it was fixed.
 [2015-03-29 04:11 UTC] kalle@php.net
-Package: *Compile Issues +Package: Scripting Engine problem
 [2015-03-29 04:11 UTC] kalle@php.net
Fixed category
 [2015-03-29 08:03 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2015-03-29 08:03 UTC] nikic@php.net
Will throw a compile error in PHP 7.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 14:01:35 2025 UTC