Fatal error: Cannot use string offset as an array in nivo_slider/nivo_slider_slides.admin.inc on line 59 when I try to edit slider (?=admin/structure/nivo-slider). First-time editing (after installing module) works until I'm trying to save the slider.
If I comment line 59 in module source (nivo_slider/nivo_slider_slides.admin.inc), the module could work, but results are weird — I receive a notice Notice: Uninitialized string offset: 0 in function nivo_slider_slider() (line 60 in sites/all/modules/nivo_slider/slider.inc).

Comments

electrichound’s picture

Change code in line 59 from '#default_value' => $settings['description']['value'],
to '#default_value' => isset($settings['description']['value']) ? $settings['description']['value'] : ' ',
It works, but I get notices like above (Notice: Uninitialized string offset: 0 in function nivo_slider_slider() (line 60 in sites/all/modules/nivo_slider/slider.inc).

dasgalloway’s picture

Edit: I uninstalled the Nivo Slider module, deleted the nivo_slider folder from my modules folder, and reinstalled. So long as you do not delete ALL of the slides, this issue does not occur. I believe it is removing information from the nivo_slider_banner_settings variable when you do this, and there doesn't seem to be a case for what to do when you go to the admin page when this is empty.

I'm getting the same thing after I updated. Everything seemed to be working until I deleted my existing slides and tried to add a new one fresh. I don't know if it's the same case as electrichound or not, but it's definitely the same error.

In addition to the string offset as array error, I am also receiving the following:

Notice: Uninitialized string offset: 0 in nivo_slider_settings_submit() (line 135 of /drupal/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
Notice: Uninitialized string offset: 0 in nivo_slider_slide_configuration_form() (line 38 of /drupal/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
Notice: Uninitialized string offset: 0 in nivo_slider_slide_configuration_form() (line 44 of /drupal/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
Notice: Uninitialized string offset: 0 in nivo_slider_slide_configuration_form() (line 48 of /drupal/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
Notice: Uninitialized string offset: 0 in nivo_slider_slide_configuration_form() (line 53 of /drupal/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
Notice: Uninitialized string offset: 0 in nivo_slider_slide_configuration_form() (line 59 of /drupal/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
Notice: Uninitialized string offset: 0 in nivo_slider_slide_configuration_form() (line 38 of /drupal/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
Notice: Uninitialized string offset: 0 in nivo_slider_slide_configuration_form() (line 44 of /drupal/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
Notice: Uninitialized string offset: 0 in nivo_slider_slide_configuration_form() (line 48 of /drupal/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
Notice: Uninitialized string offset: 0 in nivo_slider_slide_configuration_form() (line 53 of /drupal/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
Notice: Uninitialized string offset: 0 in nivo_slider_slide_configuration_form() (line 59 of /drupal/sites/all/modules/nivo_slider/nivo_slider_slides.admin.inc).
electrichound’s picture

Actually, I got the same messages in admin/structure/nivo_slider section. So I think we both have one issue.
==
I've tried your method, but it doesn't solve the issue for me. When I'm trying to add an image to slider (actually, even if I'm just saving default images), I get the same Fatal error.
So, the only way to make it work is to edit the line 59, even just comment out.

devin carlson’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Assigned: Unassigned » devin carlson
Status: Active » Needs review
StatusFileSize
new3.64 KB

A test to see if the tests are now enabled for Nivo Slider.

devin carlson’s picture

StatusFileSize
new3.64 KB

Lets try that again.

Status: Needs review » Needs work

The last submitted patch, provide-default-values-1518206-5.patch, failed testing.

devin carlson’s picture

Status: Needs work » Needs review
StatusFileSize
new6.06 KB

Automated testing is now up and running!

The attached patch should solve this issue (and the failing tests).

devin carlson’s picture

Status: Needs review » Fixed

Committed to 7.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.