Hi there,

When I enable the "outline_designer_book" module and go edit one of my books, I get this fatal error message:

Warning: Illegal string offset '#tree' in form_builder() (line 1891 of /home/vagrant/d7/web/includes/form.inc).
Warning: Cannot assign an empty string to a string offset in form_builder() (line 1891 of /home/vagrant/d7/web/includes/form.inc).
Warning: Illegal string offset '#tree' in form_builder() (line 1911 of /home/vagrant/d7/web/includes/form.inc).
Notice: Uninitialized string offset: 0 in form_builder() (line 1911 of /home/vagrant/d7/web/includes/form.inc).
Warning: Illegal string offset '#parents' in form_builder() (line 1911 of /home/vagrant/d7/web/includes/form.inc).
Notice: Array to string conversion in form_builder() (line 1911 of /home/vagrant/d7/web/includes/form.inc).
Warning: Illegal string offset '#array_parents' in form_builder() (line 1916 of /home/vagrant/d7/web/includes/form.inc).
Notice: Array to string conversion in form_builder() (line 1916 of /home/vagrant/d7/web/includes/form.inc).
Warning: Illegal string offset '#weight' in form_builder() (line 1920 of /home/vagrant/d7/web/includes/form.inc).
Warning: Illegal string offset '#processed' in form_builder() (line 1802 of /home/vagrant/d7/web/includes/form.inc).
Warning: Cannot assign an empty string to a string offset in form_builder() (line 1802 of /home/vagrant/d7/web/includes/form.inc).
Error: Unsupported operand types in form_builder() (line 1812 of /home/vagrant/d7/web/includes/form.inc).

After doing some research, it seems like the issue lies on PHP 7+ installs. (Refer to: https://www.drupal.org/project/workbench_moderation/issues/2871962)
Not sure what's generating the issue on this module, per se. Perhaps it needs to return an array where it's returning a string somewhere.

Thanks!

CommentFileSizeAuthor
#7 2930286-php7.1-fix.patch854 bytesdjdevin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

caiobianchi created an issue. See original summary.

btopro’s picture

we run OD on php 7 in local dev / staging but haven't run into this; are there items in the book you are viewing?

Anonymous’s picture

Title: Error when enabling outline_designer_book » _outline_designer_book_admin_form_alter incompatible with PHP 7.1+
Issue tags: +PHP 7.1

This error is due to using an empty string as an array in _outline_designer_book_admin_form_alter . That is illegal starting in PHP 7.1 (legal in 7.0). See "The empty index operator is not supported for strings anymore" in http://php.net/manual/en/migration71.incompatible.php .

Fix:

  // unset things so that the form renders with everything stripped off
  $form["#submit"] = array();
  $form["save"] = array();
btopro’s picture

nice, can you please submit a patch for this and I can get it in

Anonymous’s picture

Sorry, I don't know how to make a patch in the correct format.

It's just the two-line change though.

btopro’s picture

I'll accept patches for this for sure, but I'm not manually fixing this even if it is 2 lines. It's very easy to make a patch and I appreciate the feedback and solution (assuming it works). https://drupalize.me/videos/applying-and-creating-patches-git?p=1173 has videos on the subject which is helpful for development beyond just drupal

djdevin’s picture

Status: Active » Needs review
FileSize
854 bytes

  • btopro committed 2556e87 on 7.x-2.x authored by djdevin
    Issue #2930286 by djdevin: _outline_designer_book_admin_form_alter...
btopro’s picture

Status: Needs review » Fixed

up there thx devin!

Status: Fixed » Closed (fixed)

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

Grabby’s picture

Sorry to reopen this issue, but I’m getting

    Warning: Illegal string offset '#tree' in form_builder() (line 1895 of MySite\includes\form.inc).
    Warning: Cannot assign an empty string to a string offset in form_builder() (line 1895 of MySite\includes\form.inc).
    Warning: Illegal string offset '#tree' in form_builder() (line 1915 of MySite\includes\form.inc).
    Notice: Uninitialized string offset: 0 in form_builder() (line 1915 of MySite\includes\form.inc).
    Warning: Illegal string offset '#parents' in form_builder() (line 1915 of MySite\includes\form.inc).
    Notice: Array to string conversion in form_builder() (line 1915 of MySite\includes\form.inc).
    Warning: Illegal string offset '#array_parents' in form_builder() (line 1920 of MySite\includes\form.inc).
    Notice: Array to string conversion in form_builder() (line 1920 of MySite\includes\form.inc).
    Warning: Illegal string offset '#weight' in form_builder() (line 1924 of MySite\includes\form.inc).
    Warning: Illegal string offset '#processed' in form_builder() (line 1806 of MySite\includes\form.inc).
    Warning: Cannot assign an empty string to a string offset in form_builder() (line 1806 of MySite\includes\form.inc).
    Error: Unsupported operand types in form_builder() (line 1816 of MySite\includes\form.inc).

with 7.x-2.x-dev running PHP 7.1.1 when I click on “edit order and titles”. 7.x-2.x-dev obviously includes the patch in #7 so I’m not sure where to go. FWIW the site has two languages.

Grabby’s picture

Sorry, I made a mistake, 7.x-2.x-dev works fine. Please ignore my previous post!