undefined model method does not rise error |
Hello,
I've noticed that when you call a model->method that hasn't been defined, CI doesn't display any error (see the example below) PHP Code: $model = model('MyModel'); In my case, this is an undesired behavior, can be very tricky to debug I've solved the problem temporarily by commenting the definition of system/Model::__call() Is there a config parameter to control it? What is your opinion? EDIT: here's a workaround that keeps the model magics but rises error if you call an undefined method, hope this helps hack: PHP Code: elseif (method_exists($this, $name)) { complete method: PHP Code: public function __call(string $name, array $params)
I hope this is a bug. Because if this is intentional, like you say it will be hard to test and debug! I will try to reproduce this...
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
He's correct I just tried it here and it gave me no error also using the DebugToolBar.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Glad to see I'm not alone, so it seems it's not a desired behavior
I've tested a workaround and added the code to the first post Though I'm not sure it could be a bugfix 'cause I don't know the system architecture that well
To learn the CodeIgniter architecture just open and follow the code in index.php and .\system\Codeigniter.php
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
@carlorfeo,
I think this is is a major BUG and dread to think of the other repercussions!!! > Is there a config parameter to control it? Code: # file: system/config/Services.php Output: Quote:Fatal error: Uncaught Error: Call to a member function initialize() on null in /var/www/ci4-strict.tk/system/CodeIgniter.php:190
this bug has been fixed: https://github.com/codeigniter4/CodeIgni...ssues/2688
Cool, that was quick!
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/ |
Welcome Guest, Not a member yet? Register Sign In |