Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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!
Comment | File | Size | Author |
---|---|---|---|
#7 | 2930286-php7.1-fix.patch | 854 bytes | djdevin |
Comments
Comment #2
btopro CreditAttribution: btopro commentedwe run OD on php 7 in local dev / staging but haven't run into this; are there items in the book you are viewing?
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedThis 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:
Comment #4
btopro CreditAttribution: btopro commentednice, can you please submit a patch for this and I can get it in
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedSorry, I don't know how to make a patch in the correct format.
It's just the two-line change though.
Comment #6
btopro CreditAttribution: btopro commentedI'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
Comment #7
djdevinComment #9
btopro CreditAttribution: btopro commentedup there thx devin!
Comment #11
Grabby CreditAttribution: Grabby as a volunteer commentedSorry to reopen this issue, but I’m getting
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.
Comment #12
Grabby CreditAttribution: Grabby as a volunteer commentedSorry, I made a mistake, 7.x-2.x-dev works fine. Please ignore my previous post!