Quantcast
Channel: Fatal error: Call to private MyObject::__construct() from invalid context - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by Danny Michaeli for Fatal error: Call to private...

For me its was that the name of the CLASS was the same name as one of the methodsthat was private...for example...class myClass { public function __construct() { } private function myClass() { }}

View Article



Answer by Mogogy for Fatal error: Call to private MyObject::__construct()...

Instead of $x = new MyObject() you could use$x = MyObject::getInstance();assuming that MyObject is a Singleton and getInstance() function is available.

View Article

Answer by zombat for Fatal error: Call to private MyObject::__construct()...

Your MyObject class has a protected or private constructor, which means that the class cannot be instantiated. __construct() functions are always called when an object is instantiated, so trying to do...

View Article

Fatal error: Call to private MyObject::__construct() from invalid context

When creating a new object in PHP, I get the following error message:Fatal error: Call to private MyObject::__construct() from invalid contextI just create the new object and do not try to call the...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images