03 Sep 2013
Drupal – How I Fixed “Trying to get property of non-object” / “array_flip()” Module Error
When moving items from a staging server over to a production server, you occasionally run into strange issues (especially when they’re not 100% identical).
This particular server has some older, “secure” settings enabled (such as Safe Mode for PHP).
When installing a Drupal module manually, things went well until I tried to use its upload function. I experienced the following error:
Notice: Trying to get property of non-object in nivo_slider_settings_submit() (line 213 of /var/www/vhosts/awebsite.com/httpdocs/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc). Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /var/www/vhosts/awebsite.com/httpdocs/includes/entity.inc). Notice: Trying to get property of non-object in nivo_slider_slide_configuration_form() (line 72 of /var/www/vhosts/awebsite.com/httpdocs/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
Long story short, this particular module creates a directory in sites/default/files called banner. The permissions it generated for this directory were incorrect and also some reason unchangeable.
The solution was simple — delete the generated directory, recreate it, redo the permissions.
Easy! Hope it helps.