|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-02-05 19:47 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
-Package: Compile Failure
+Package: Scripting Engine problem
[2014-02-05 19:47 UTC] requinix@php.net
[2014-02-05 20:55 UTC] Viktorlubchuk at gmail dot com
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 08:00:02 2026 UTC |
Description: ------------ the is bug is that I appeal to the public methods as static and it works i try it on php versions 5.4 , 5.3 and its outputting error as it should be <?php namespace PHP_SINGLETONE; abstract class Example { public static $counter = null; protected $num; public function __construct() { } public function in() { $class = get_called_class(); if ($class::$counter === null) { $class::$counter = new $class(); } return $class::$counter; } public function doSome($string) { echo get_called_class(). " ".$string."<br>"; } public function showNum($number) { $this->num = $number; return $this->num; } } class Example1 extends Example { public static $counter = null; } class Example2 extends Example { public static $counter = null; } $var = Example1::in(); $var::doSome('var1'); $var1 = Example2::in(); $var1::doSome('var2'); var_dump($a = $var1->showNum("6")); echo $a; Expected result: ---------------- i`m expecting to error that say - I can not appeal to the public methods as static