dre1080 / warden

More than just a user database auth package for FuelPHP
http://dre1080.github.com/warden
MIT License
46 stars 11 forks source link

Getting fatal error on user model on save #27

Closed bperin closed 11 years ago

bperin commented 11 years ago

After I migrated to 2.0 I keep getting the same fatal error

Error - 2013-01-08 23:13:38 --> 2 - array_merge(): Argument #1 is not an array in packages/warden/classes/warden/model/user.php on line 1005

which is the line

private static function _add_dynamic_properties(array $props) { static::$_properties = array_merge(static::$_properties, $props);//fails here }

j Trying to debug this, maybe its trying to add a dynamic property before somehow the model has been constructed?

bperin commented 11 years ago

The issue isn't typecasting an array the issue is that the default static::$_properties array nullifies as soon as any dynamic values are attempted to add to it, so the final properties array is just the last dynamic property array added to it

dre1080 commented 11 years ago

What version of fuel and php are you running?

bperin commented 11 years ago

Fuel 1.4 PHP 5.4.10

I got it working by adding an array of default properties, and dynamic properties. check out my fork https://github.com/bperin/warden

Basically I just changed the _add_dynamic_properties method to build on the _dynamic_properties array and then at the end of init() combine _default_properties and _dynamic_properties. Frankly I don't see why it works and why the original code didn't. I'll go through it again but possibly a bug in one of the static methods called in _add_feature_properties() was nullifying the _properties array.