Welcome Guest, Not a member yet? Register   Sign In
Help adding CI3 compatibility to Flexi Auth
#1

Hi there,

I am trying to update flexi auth so it's compatible with CI3
https://github.com/haseydesign/flexi-auth

I've gone through the process of upgrading as per the user guide (http://www.codeigniter.com/userguide3/in...ading.html)

But I have run into the following error that I cannot fix the following error. Can anyone give me any ideas on how to fix this error. Guessing it's pretty simple, but since this is my first attempt at updating to 3.0 I am not sure.

PHP Code:
SeverityError
Message
: Class ‘CI_Flexi_auth_lite’ not found
Filename
core/Common.php
Line Number
185 

I'm pretty sure the original developer has moved on from CI, but I'd like to be able to upgrade an existing project using flexi auth to take advantage of some features in CI3.

Any help greatly appreciated.
Reply
#2

This appears to happen when the the 'Library Flexi_auth' tries to load another library 'Flexi_auth_lite' in order to extend it:

load_class('Flexi_auth_lite', 'libraries', FALSE);
class Flexi_auth extends Flexi_auth_lite

Many thanks,

Tom
Reply
#3

(This post was last modified: 11-11-2014, 06:00 PM by benedmunds.)

I couldn't tell from your reply if you had solved your issue. The only problem I've had with CI3 class loading compatibility is the class name and file name upper/lower casing.
- Ben Edmunds
 CI Counsel Member  |  @benedmunds
 Ion Auth  |  Securing PHP Apps
Reply
#4

Sorry -- No I have not solved the problem. I'm at a bit of a loss for the problem, everything else I've upgraded no problem.

I am not sure why the error is trying to load ‘CI_Flexi_auth_lite’ when the call is: load_class('Flexi_auth_lite', 'libraries', FALSE);

Calling library is:
File: Flexi_auth.php
Code:
load_class('Flexi_auth_lite', 'libraries', FALSE);
class Flexi_auth extends Flexi_auth_lite{...}

The file and class name for the file it should be loading are:

File: Flexi_auth_lite.php
Class: class Flexi_auth_lite(){...}

Both are in the /application/libraries folder.

Many thanks,

Tom
Reply
#5

Ok I found a fix, was how the library was being called, just needed to change

load_class('Flexi_auth_lite', 'libraries', FALSE);

to

$CI =& get_instance();
$CI->load->library('Flexi_auth_lite’);

Unless anyone is aghast at the idea of doing that?
Reply
#6

That is a normal way to do things.

If you use $CI a lot in your Library, then use

PHP Code:
$this->CI->load->library('Flexi_auth_lite’); 

and use the same pattern for all the other calls.

Obviously the $CI variable must be a class variable to use $this.
Reply
#7

(11-14-2014, 08:52 AM)Chroma Wrote: That is a normal way to do things.

If you use $CI a lot in your Library, then use


PHP Code:
$this->CI->load->library('Flexi_auth_lite’); 

and use the same pattern for all the other calls.

Obviously the $CI variable must be a class variable to use $this.

Yes -- I am not sure why it was not like this to start - presumably it was a workaround for something in CI2.0
Reply
#8

Are you going to fork this project with your changes, or have you already done so?
Reply
#9

(11-16-2014, 09:57 PM)bclinton Wrote: Are you going to fork this project with your changes, or have you already done so?

Sorry for the slow response. I actually have a slightly modified version for my project, but I just forked the standard project and will apply the fix to it there. Post the link once i'm done.

Cheers,

Tom
Reply
#10

(12-07-2014, 11:27 PM)mrtomtom Wrote:
(11-16-2014, 09:57 PM)bclinton Wrote: Are you going to fork this project with your changes, or have you already done so?

Sorry for the slow response. I actually have a slightly modified version for my project, but I just forked the standard project and will apply the fix to it there. Post the link once i'm done.

Cheers,

Tom



hi there any chance of getting the link to download this ?

thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB