KObject does not require $config->service_container to be defined during __construct, which is fine.
But it do expect it to be defined when KObject->getService is called.
However, should you extend an KObject class in your own, and:
- Forget to call parent::__construct($config); in your __construct method or otherwise forget to set $this->__service_container.
- Call $this->getService() before parent::__construct($config) is called.
Then a cryptic error will happen:
PHP Fatal error: Call to a member function get() on a non-object in /libraries/koowa/object/object.php on line 252
Since no exception is thrown, no callstack is shown either so it becomes incredibly hard to figure out what's wrong.
This patch simply adds an exception call in getService should the service container be undefined.
No file chosen
You have an empty file field. Please select or remove it.
Drop the files anywhere in this page to upload them as attachments.