php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16265 Multiply-defined functions in classes not reported
Submitted: 2002-03-25 13:12 UTC Modified: 2002-12-06 19:36 UTC
From: dshadow at zort dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.1.2 OS: Linux
Private report: No CVE-ID: None
 [2002-03-25 13:12 UTC] dshadow at zort dot net
PHP does not report multiply-defined errors for class member functions. For example, the following script below, when executed, only outputs "two", with no errors.

Instead, PHP should be giving error messages since the function bar has been defined multiple times.

<?
class foo
{
        function bar() {echo "one\n";}
        function bar() {echo "two\n";}
}

$f = new foo();
$f->bar();

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-25 15:32 UTC] derick@php.net
Fixed in CVS, will also be in PHP 4.2.0

Derick
 [2002-04-01 21:37 UTC] yohgaki@php.net
Need to open again.
This bug may be suspended.
 [2002-04-02 01:43 UTC] derick@php.net
I'm suspending this for now, this issue is not easily solved unfortunately. But we keep this on the todo list for future releases.

Derick
 [2002-12-06 19:36 UTC] sniper@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, 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/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


I get this error with your script:

Fatal error: Cannot redeclare bar() in /home/jani/t.php on line 6
/home/jani/t.php(6) : Fatal error - Cannot redeclare bar()

So it seems to be fixed.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 26 21:01:30 2024 UTC