Bug #68872 [Com]: all
| From: | spam dot remy at hotmail dot com | Date: | Wed, 21 Jan 2015 10:16:40 +0000 |
| Subject: | Bug #68872 [Com]: all | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190104@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68872&edit=1
ID: 68872
Comment by: spam dot remy at hotmail dot com
Reported by: mlboy at 126 dot com
Summary: all
Status: Open
Type: Bug
Package: Class/Object related
Operating System: centos7
PHP Version: 5.6.4
Block user comment: N
Private report: N
New Comment:
That is correct behaviour. From http://php.net/manual/en/language.oop5.decon.php
:
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.
Previous Comments:
------------------------------------------------------------------------
[2015-01-21 09:55:44] mlboy at 126 dot com
Description:
------------
---
From manual page: http://www.php.net/language.oop5
---
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:
---------------
<?php
class A{
static public function A(){
echo 'hi';
}
}
A::A();
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68872&edit=1