Doc #63053 [NEW]: static keyword wrong!!

From: Date: Mon, 10 Sep 2012 08:47:39 +0000
Subject: Doc #63053 [NEW]: static keyword wrong!!
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8847@lists.php.net to get a copy of this message
From:             yyb8 at vip dot qq dot com
Operating system: win2003
PHP version:      5.4.6
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:static keyword wrong!!

Description:
------------
in this page http://cn2.php.net/manual/en/language.oop5.static.php

write:
"
Calling non-static methods statically generates an E_STRICT level warning.
"

Bug it is not always right!

e.g. 

Test script:
---------------
<?php
class A {
    public function foo() {
        echo "success!\n";
    }
    public function test() {
     
	    A::foo(); //no E_STRICT level warning
		 
    }
}

class B extends A {
   
public function test() {
       
	   A::foo();//no E_STRICT level warning

	   B::foo();//no E_STRICT level warning

    }

}

 

$b = new B();
$b->test();
 

$a = new A();
$a->test();
?>

will print 
success!
success!
success!


 with no error.

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


Strict Standards: Non-static method A::foo() should not be called
statically, assuming $this from incompatible context in
E:\Inetpub\wwwroot\php\Noname15.php on line 20
success!

 

Actual result:
--------------
success!
success!
success!
 

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



Thread (3 messages)

« previous php.doc.bugs (#8847) next »