Errors
I don't implement many checks because I want performance (moreso I want to save CPU cycles due to global warming), so I log common errors here
There's an ExceptionCatcher to nicely report some messages, but certain errors are not catchable as far as I can tell.
TODO: Write a Debug addon for Lia that:
- checks all methods to check for the php fatal error with recursive method calling
PHP Fatal error: Allowed Memory Size Exhausted
The line number may change & the bytes are certainly different depending on setup. I don't intend to fix or handle this error. Don't code it.
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /home/.../Liaison/code/class/Lia.php on line 97
This error references code:
public function __call($method, $args){
return $this->methods[$method](...$args);
}
A cause of this __call
function producing the error is:
$lia->methods['some_method'] = [$addon, 'some_method'];
$lia->some_method();
where $this->some_method()
does not exist. The Stack is like:
1. $lia->some_method() invokes $lia->__call('some_method')
2. $lia->__call() gets $lia->methods['some_method'] and invokes it.
3. $lia->methods['some_method'] points to callable [$addon, 'some_method']
4. $addon->some_method() invokes $addon->_call('some_method')
5. this process repeats from 1. except with $addon as the object instead of $liaison
//
Since $addon->methods = &$lia->methods,
and $addon is a subclass of $lia,
it invokes [$addon, 'some_method']