Bug #52160 [NEW]: Invalid E_STRICT redefined constructor error

From: Date: Wed, 23 Jun 2010 13:21:30 +0000
Subject: Bug #52160 [NEW]: Invalid E_STRICT redefined constructor error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-151804@lists.php.net to get a copy of this message
From:             
Operating system: Linux
PHP version:      5.2.14RC1
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Invalid E_STRICT redefined constructor error

Description:
------------
The following class generates the E_STRICT warning: Strict standards:
Redefining already defined constructor for class Log. 

However according to http://php.net/manual/en/language.oop5.decon.php,
PHP5
will only assume log() is a constructor if it cannot find a __construct()
method:

"For backwards compatibility, if PHP 5 cannot find a __construct() function
for a given class, it will search for the old-style constructor function,
by the name of the class."

Since it has already found a __construct() method, it should not assume
that log() is also a constructor. 

Test script:
---------------
<?php
class Log
{
	public function __construct() { } 
	public static function log() { }
}

Expected result:
----------------
Nothing

Actual result:
--------------
Strict standards: Redefining already defined constructor for class Log in
....

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52160&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=52160&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=52160&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=52160&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=52160&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52160&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=52160&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=52160&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=52160&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=52160&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=52160&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=52160&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=52160&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=52160&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=52160&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52160&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52160&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=52160&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=52160&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=52160&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=52160&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=52160&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#151804) next »