Welcome Guest, Not a member yet? Register   Sign In
flexi auth - A user authentication library for CodeIgniter

[eluser]katanama[/eluser]
[quote author="jasonlally" date="1355896985"]I am currently getting this error on the demo when purposefully submitting a registration with errors. I'm trying to test the messages:

Fatal error: Cannot access protected property Auth::$data in /[my directory]/application/models/demo_auth_model.php on line 10

Registration happens perfectly when I don't try to trip it up. Line 10 is the return of the following function in the Demo_auth_model class:

Code:
public function &__get($key)
{
  $CI = get_instance();
  return $CI->$key;
}

Any idea what could be causing this? Oddly the comment says this function is explicitly to avoid this error:

// The following method prevents an error occurring when $this->data is modified.

But I'm still getting it. I'm on CodeIgniter 2.1.3[/quote]

I'm also new to Flexi Auth and beginner in PHP, but let me try to help you.

1. Are you using HMVC extension? Which one?

2. How do you declare your $data in your controller?
- As a class member properties, or?
- as a method variable, or?
- in the constructor as a new stdClass like in the demo?

&__get($name) is a PHP magic method that handle overloading.

Quote:http://php.net/manual/en/language.oop5.o...object.get

public mixed __get ( string $name )

The $name argument is the name of the property being interacted with.

Property overloading only works in object context. These magic methods will not be triggered in static context. Therefore these methods should not be declared static. As of PHP 5.3.0, a warning is issued if one of the magic overloading methods is declared static.


Messages In This Thread
flexi auth - A user authentication library for CodeIgniter - by El Forum - 12-18-2012, 11:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB