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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: chrism at FOUR dot net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC