|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68872 all
Submitted: 2015-01-21 09:55 UTC Modified: 2015-01-21 10:20 UTC
From: mlboy at 126 dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.6.4 OS: centos7
Private report: No CVE-ID: None
 [2015-01-21 09:55 UTC] mlboy at 126 dot com
From manual page:
when call a static funciton name with a same as class name will get this error.

  1 <?php
  2 class A{
  3     static public function A(){
  4         echo 'hi';
  5     }
  6 }
  7 A::A();
Fatal error: Constructor A::A() cannot be static in /t.php on line 6

Test script:
class A{
    static public function A(){
      echo 'hi';


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-21 10:16 UTC] spam dot remy at hotmail dot com
That is correct behaviour. From :
if PHP 5 cannot find a __construct() function for a given class, and the class did not inherit one from a parent class, it will search for the old-style constructor function, by the name of the class.
 [2015-01-21 10:20 UTC]
-Status: Open +Status: Not a bug
 [2015-01-21 10:20 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 20:01:30 2024 UTC