Bug #54310 [Opn->Csd]: Class Method & Function Arguments are allowed to be named the same
Edit report at https://bugs.php.net/bug.php?id=54310&edit=1
ID: 54310
Updated by: nikic@php.net
Reported by: nicholas dot j dot miller at gmail dot com
Summary: Class Method & Function Arguments are allowed to be
named the same
-Status: Open
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: ANY
PHP Version: 5.3.6
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Will throw a compile error in PHP 7.
Previous Comments:
------------------------------------------------------------------------
[2015-03-29 04:11:04] kalle@php.net
Fixed category
------------------------------------------------------------------------
[2011-03-22 13:23:17] felipe@php.net
What has been treated in bug #43512 was a memory issue. And it was fixed.
------------------------------------------------------------------------
[2011-03-22 13:16:50] jinmoku at hotmail dot com
see
http://bugs.php.net/bug.php?id=43512
------------------------------------------------------------------------
[2011-03-19 03:59:22] 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'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54310&edit=1
Thread (5 messages)