php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32490 constructor of mysqli has wrong name
Submitted: 2005-03-29 21:55 UTC Modified: 2015-09-01 16:36 UTC
From: ladoo at gmx dot at Assigned: cmb
Status: Closed Package: MySQLi related
PHP Version: 7.0.0RC1 OS: *
Private report: No CVE-ID:
 [2005-03-29 21:55 UTC] ladoo at gmx dot at
Description:
------------
Due to the PHP5 manual the constructor of a class shall be called __construct and the method named after the class is evaluated only for compatibility reasons. The constructor of the mysqli class is mysqli, but it should be __construct.

Reproduce code:
---------------
$x = new mysqli();
if(method_exists($x, "mysqli")) echo  "mysqli exists";
if(method_exists($x, "__construct")) echo "__construct exists";

Expected result:
----------------
__construct exists

Actual result:
--------------
mysqli exists

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-29 23:41 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-04-06 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2015-09-01 11:36 UTC] cmb@php.net
-Status: No Feedback +Status: Open -Operating System: Linux (x86) +Operating System: * -PHP Version: 5.0.3 +PHP Version: 7.0.0RC1
 [2015-09-01 16:31 UTC] cmb@php.net
-Summary: constructor of mysqli is wrong named +Summary: constructor of mysqli has wrong name
 [2015-09-01 16:36 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2015-09-01 16:36 UTC] cmb@php.net
It seems to be arguable whether this is a bug in PHP 5, because
PHP 4 style constructors are fine there, but as of PHP 7 these
constructors are deprecated, so ::mysqli() should be renamed to
::__construct().
 [2015-09-01 19:45 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b15eff63862c9ac24184b8121431019a352a42f8
Log: Fix #32490: constructor of mysqli has wrong name
 [2015-09-01 19:45 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2015-09-03 18:10 UTC] ab@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b15eff63862c9ac24184b8121431019a352a42f8
Log: Fix #32490: constructor of mysqli has wrong name
 [2016-07-20 11:36 UTC] davey@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b15eff63862c9ac24184b8121431019a352a42f8
Log: Fix #32490: constructor of mysqli has wrong name
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC