Re: Q: static method working in PHP4 and PHP5

From: Date: Thu, 24 Mar 2005 13:26:05 +0000
Subject: Re: Q: static method working in PHP4 and PHP5
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-211457@lists.php.net to get a copy of this message
Piotr Klaban wrote:
Hi, An example script: <?php error_reporting(4095); class Foo {
    function test() {
    }
} Foo::test(); ?> would produce in PHP5 error: PHP Strict Standards: Non-static method Foo::test() should not be called statically in ... line 8 I have two questions: 1. Could it be possible that under specific circumstances such a call can produce fatal error "Non-static method Foo::test() cannot be called statically"? no
2. Is there a proper way to write such a class that would work properly in both PHP4 and PHP5, without Strict errors? no, unless you keep this code and turn off E_STRICT error_reporting
Best regards,


« previous php.general (#211457) next »