php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23042 Cannot redefine function in class
Submitted: 2003-04-03 16:48 UTC Modified: 2003-04-04 14:38 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: patrice dot ferlet at wanadoo dot fr Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.1 OS: Linux mandrake 9.1
Private report: No CVE-ID: None
 [2003-04-03 16:48 UTC] patrice dot ferlet at wanadoo dot fr
Fatal error: Cannot redeclare copixaction() in 
/var/www/html/newcopix/utils/copix/core/CopixAction.class.php on line 
59 
 
Last version of PHP worked but not today with 4.3.1. 
I cannot redefine a function in class... but i do oop ! 
thanks 

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-03 19:40 UTC] sniper@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.



 [2003-04-04 01:50 UTC] patrice dot ferlet at wanadoo dot fr
try this:

class test
{
  function blah ($one, $two)
  {
    echo "ONE\n";
  }
  function blha ($one, $two, $three)
  {
    echo "TWO";
  }
}

In OOP, we can declare several prototypes of a class method, in php 4.0 i could do this, but with php 4.3.1 i cannot anymore.
I think this is a very important problem.
For a framework i use (and i contribute) this is a real big problem!
 [2003-04-04 02:48 UTC] wez@php.net
We fixed a bug so that it displays a warning when you try to do this.
It never actually worked in earlier releases (try it!), and we never stated that you could overload functions in this way in the manual.
 [2003-04-04 14:38 UTC] patrice dot ferlet at wanadoo dot fr
the fact is here... ;o)
http://copix.aston.fr with php 4.1 and http://www.metal3d.com/copix php 4.3.1
this is the same code source...
 [2004-01-18 22:54 UTC] webmaster at mentch dot net
I have had the same experience.  In PHP 4.2.2, I could have a function name with multiple declarations with different parameters.  However, I just migrated the site to a server that has PHP 4.3.5 and it crashed with that same fatal error??  What gives?  

In PHP 4.2.2 and earlier, I could use both functions prototypes successfully when they were in the same class...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Aug 18 12:01:28 2024 UTC