![]() |
Hi there,
I've today upgraded from V4.3.5 to V4.3.6. I've checked the upgrade notes and am not making use of any of the listed breaking changes. Despite this, my project has broken ![]() The problem appears to be in the loading of a factory. I'm loading the factory as per documentation in my BaseController file: Code: $this->resultModel = Factories::models('ResultModel'); This is generating the following warnings in the logs: Code: WARNING - 2023-06-20 14:56:49 --> [DEPRECATED] trim(): Passing null to parameter #1 ($string) of type string is deprecated in SYSTEMPATH/Config/Factories.php on line 82. Just to add, I've downgraded back to V4.3.5 and the warnings have gone.
Cannot reproduce the error.
PHP Code: <?php I see a blank page, no error. Quote:trim(): Passing null to parameter #1 ($string) of type string is deprecated in SYSTEMPATH/Config/Factories.php on line 82. https://github.com/codeigniter4/CodeIgni...es.php#L82 As far as I know, there is no way to set the $arguments to null. So I don't understand why the error occurs. Quote:7 SYSTEMPATH/Database/BaseResult.php(391): CodeIgniter\Database\BaseResult->getResult('App\\Models\\UserModel') Why do you specify the class UserModel ? It is strange. https://codeigniter4.github.io/CodeIgnit...tom-object https://codeigniter4.github.io/CodeIgnit...lt-objects
Thanks for taking the time to reply. I'll investigate further tomorrow as to what is going on and report back. I now suspect there is something peculiar about my code that I've overlooked.
What PHP version are you running?
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(06-20-2023, 11:05 PM)InsiteFX Wrote: What PHP version are you running? I'm using PHP 8.2.7. I've noticed something problematic with my code. In the class I'm loading I think I may have chosen some poor method names which could inadvertently be overriding some of CodeIgniter's functionality leading to unpredicatable results. I'm going to investigate further and do some refactoring.
(06-20-2023, 02:44 PM)kenjis Wrote:This has really helped as I have now resolved the problem. I think there were two things wrong with my code creating unexpected results. The factory I was loading had methods that inadvertently conflicted with CI methods, so I have renamed them. Additionally my variable scopes were wrong when storing the result of loading the factory possibly giving rise to the null warnings in the logs. I've changed them to be private to each class and it has resolved the issue.Quote:7 SYSTEMPATH/Database/BaseResult.php(391): CodeIgniter\Database\BaseResult->getResult('App\\Models\\UserModel') Thanks for pointing me in the right direction
I have CodeIgniter 4 v4.3.6 running fine with php 8.2.7 on my live site.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |