[eluser]Frank Liu[/eluser]
[quote author="OverZealous" date="1269045695"][quote author="Frank Liu" date="1269039113"]DMZ's main library file contains spl_auto_load function, which is not supported until PHP 5.1.2. So you may want to change server requirement to reflect this?
Anyway, can I just remove the spl_auto_load statement and find another way to load the files? Do you have a recommended way to deal with this problem? I am using php 5.0.0.[/quote]
I did not realize that (I've thankfully never had to deal with PHP older than 5.2, because I use the JSON functions a lot!)
I'll take your suggestion and bump the requirements up to 5.1.2. As for a work-around, all the spl function is doing is loading the models in as they are needed. I know I "broke" the ability to load models via CI (which will be remedied with 1.7.1), but you can temporarily fix that by removing the private in front of the _assign_libraries function in the main library. It's near the bottom.
Another option is to write your own helper or library, or even extension to DMZ that allows you to load the models in as needed.
Sorry to hear about your work environment! hut:[/quote]
This is just to provide a small closure on this matter. So if you are using an older version of PHP that does not support spl_autoload_register, then you can do the following:
In any of your config files, say config/autoload.php, append the following:
Code:
function __autoload($class_name) {
require_once(APPPATH.'libraries/datamapper.php');
DataMapper::autoload($class_name);
}
Next comment out the line that uses the spl_autoload_register function in your libraries/datamapper.php file. This hack works for me.