n00b having problems with autoloader

Discussion about the open-source Phalanger [?] project.

n00b having problems with autoloader

Postby stu » January 11th, 2013, 3:57 pm

Hi there, I'm having problems porting my existing php app which makes use of spl_autoload_register etc.

The phalanger config I'm using is pretty much straight out of the box, and the php app works happily under fast-cgi on iis.

Having googled for a number of hours I can't see anything obvious that would make my autoloader not work, and I can see from phalanger 3 svn repo that there is code in place to support autoloading.

The autoloader code is a pretty straightforward 'swap underscore for separator and rely on the default implementation' ..
Code: Select all
set_include_path(get_include_path().PATH_SEPARATOR.CLASS_DIR);
spl_autoload_extensions('.php');
spl_autoload_register(function ($class){return spl_autoload(strtolower(str_replace('_', '/', $class)));});

... so I'm operating under the assumption that there is some config that I'm missing.

Can anyone help me get this going?

thanks
stu
 
Posts: 1
Joined: January 11th, 2013, 3:27 pm

Re: n00b having problems with autoloader

Postby Jakub Misek » January 11th, 2013, 11:14 pm

Hi,
I've tried the autoload and it works as expected for me.

Try to add some debug prints into your autoload function, whether it is called ... and also check whether 'spl_autoload_register' returns TRUE.

Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 2 guests

cron

User Control Panel

Login

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 151 on December 6th, 2020, 7:46 am

Users browsing this forum: No registered users and 2 guests