Call to undefined method MY_Loader::_ci_object_to_array()

If you have been using Wiredesignz HMVC for CodeIgniter and have upgraded to CI 3.1.3, you would have been greeted by the following error message…

A PHP Error was encountered

Severity: Error

Message: Call to undefined method MY_Loader::_ci_object_to_array()

Filename: MX/Loader.php

Line Number: 300

Backtrace:

This has been brought to Wiredesignz’s attention and is awaiting to be fixed, but to get you going for now, you can do the following.

On Line 300 of application/third_party/MX/Loader.php

A Pull request has been raised on this, so hopefully a permanent solution for this will appear in the near future.

And Kudos to WireDesignz for an excellent addition to the CodeIgniter Framework. This is just a little hiccup as the CodeIgniter Developers snuck this change in without telling anyone. So a big shout out to the CodeIgniter Devs for giving us an excellent PHP Framework, which I used for years, and for all their hard work and their continued development. It’s not an easy task!

A Better Way

The above is a good fix if you are going to be using CI 3.1.3. So this can be used on versions prior to 3.1.3, we could do the following.

So instead of testing for CI Versions, it just looks to see if the function in question that went missing in CI 3.1.3 is there or not. This effectively takes care of deciding which version of CI it’s being run on and uses the appropriate function call.

Posted in CodeIgniter, PHP Programming

Leave a Reply

Your email address will not be published. Required fields are marked *

*