php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #671 new constructor feature break objects?
Submitted: 1998-08-19 22:11 UTC Modified: 1998-08-22 08:10 UTC
From: chrism at FOUR dot net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.3 OS: FreeBSD3
Private report: No CVE-ID: None
 [1998-08-19 22:11 UTC] chrism at FOUR dot net
ChangeLog documents new constructor feature.  I've not
seen any documentation on how this works, however running
some old scripts through 3.0.3 fails:
<?
class test {
        function test($what) {
        }
}

$obj = new test;
?>
The above under 3.0.1 works fine.  3.0.3 gives:
Warning: Missing argument 1 in call to test() in 303test.php3 on line 3

Is it just my luck that I used functions with the same name as the class?  Should I edit all my source?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-08-22 08:10 UTC] rasmus
Yes, you were unlucky.  A method with the same name as the class is a constructor.  If that's not what you want, you should change the name of your method.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 15 12:01:33 2024 UTC