Bug #54310 [Opn]: Class Method & Function Arguments are allowed to be named the same
Edit report at http://bugs.php.net/bug.php?id=54310&edit=1
ID: 54310
Updated by: felipe@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
Type: Bug
Package: *Compile Issues
Operating System: ANY
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
What has been treated in bug #43512 was a memory issue. And it was
fixed.
Previous Comments:
------------------------------------------------------------------------
[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 http://bugs.php.net/bug.php?id=54310&edit=1
Thread (5 messages)