Publisher is EE6 compatible, but it does not support the Fluid field. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Error on field edit screen

Status Resolved
Add-on / Version Bloqs 5.0.3
Severity
EE Version 5.4.2

Hop Studios

Oct 17, 2022

Hey Brian,

Here is the error that I encountered when trying to edit the field from Field manager.
I click on the ‘pencil’ icon or Field Name, and the following error shows up.

Fatal error: Uncaught TypeError: Illegal offset type in /home/donaldell73/domains/donaldellisgallery.com/public_html/system/user/addons/bloqs/ft.bloqs.php:990 Stack trace: #0 /home/donaldell73/domains/donaldellisgallery.com/public_html/system/user/addons/bloqs/ft.bloqs.php(973): Bloqs_ft->sortArrayByArray() #1 /home/donaldell73/domains/donaldellisgallery.com/public_html/system/user/addons/bloqs/ft.bloqs.php(695): Bloqs_ft->sortDefinitions() #2 /home/donaldell73/domains/donaldellisgallery.com/public_html/system/ee/legacy/libraries/api/Api_channel_fields.php(410): Bloqs_ft->display_settings() #3 /home/donaldell73/domains/donaldellisgallery.com/public_html/system/ee/EllisLab/ExpressionEngine/Model/Content/FieldFacade.php(226): Api_channel_fields->apply() #4 /home/donaldell73/domains/donaldellisgallery.com/public_html/system/ee/EllisLab/ExpressionEngine/Model/Content/FieldModel.php(72): EllisLab\ExpressionEngine\Model\Content\FieldFacade->getSettingsForm() #5 /home/donaldell73/domains/donaldellisgallery.com/public_html/system/ee/EllisLab/ExpressionEngine/Controller/Fields/Fields.php(578): EllisLab\ExpressionEngine\Model\Content\FieldModel->getSettingsForm() #6 /home/donaldell73/domains/donaldellisgallery.com/public_html/system/ee/EllisLab/ExpressionEngine/Controller/Fields/Fields.php(429): EllisLab\ExpressionEngine\Controller\Fields\Fields->form() #7 [internal function]: EllisLab\ExpressionEngine\Controller\Fields\Fields->edit() #8 /home/donaldell73/domains/donaldellisgallery.com/public_html/system/ee/EllisLab/ExpressionEngine/Core/Core.php(268): call_user_func_array() #9 /home/donaldell73/domains/donaldellisgallery.com/public_html/system/ee/EllisLab/ExpressionEngine/Core/Core.php(118): EllisLab\ExpressionEngine\Core\Core->runController() #10 /home/donaldell73/domains/donaldellisgallery.com/public_html/system/ee/EllisLab/ExpressionEngine/Boot/boot.php(156): EllisLab\ExpressionEngine\Core\Core->run() #11 /home/donaldell73/domains/donaldellisgallery.com/public_html/system/index.php(152): require_once('...') #12 {main} thrown in /home/donaldell73/domains/donaldellisgallery.com/public_html/system/user/addons/bloqs/ft.bloqs.php on line 990

This is following an update from Bloqs 4.8 to 5.0.3

I haven’t started to debug this in any depth yet, and thought I could inform you about it to see if there was a known issue or an easy fix for this.

Regards,
Rowan
HOP STUDIOS

#1

BoldMinded (Brian)

Oct 17, 2022

So before you upgraded, what did this page look like? What blocks were assigned to the field?

Without debugging directly, I would try this change on line 990 of that file and see if it works.

if(array_key_exists($key, $keys) && $keys[$key] && isset($toSort[$keys[$key]])) {
#2

Hop Studios

Oct 17, 2022

Hey Brian,
No, that didn’t appear to work, or change the error message.

Here are the arrays $keys and $sortBy:

Array
(
  [3] => 0
  [1] => 1
  [2] => 2
  [4] => 3
  [5] => 4
  [6] => 5
  [7] => 6
  [8] => 7
  [9] => 8
)
Array
(
  [3] => Array
      (
        [order] => 1
        [selected] => 1
        [field_name] => section_block
      )

  [1] => Array
      (
        [order] => 2
        [selected] => 1
        [field_name] => header_block
      )

  [2] => Array
      (
        [order] => 3
        [selected] => 1
        [field_name] => full_image_block
      )

  [4] => Array
      (
        [order] => 4
        [selected] => 1
        [field_name] => heading_block
      )

  [5] => Array
      (
        [order] => 5
        [selected] => 1
        [field_name] => offerings_grid_block
      )

  [6] => Array
      (
        [order] => 6
        [selected] => 1
        [field_name] => curator_block
      )

  [7] => Array
      (
        [order] => 7
        [selected] => 1
        [field_name] => quote_block
      )

  [8] => Array
      (
        [order] => 8
        [selected] => 1
        [field_name] => columns_block
      )

  [9] => Array
      (
        [order] => 9
        [selected] => 1
        [field_name] => video
      )

)

I think the issue is that ‘key’ is an array, so you can’t use the array in an ‘array_key_exists’ function call.

I’m not sure if this is what is intended, but it does cause the CP page to load:


Old:

foreach($sortBy as $key) {
            if(array_key_exists($key, $keys) && isset($toSort[$keys[$key]])) {
                $ordered[$key] = $toSort[$keys[$key]];
            }
        }

new, changing $key to $key[‘order’]:

foreach($sortBy as $key) {
            if(array_key_exists($key['order'], $keys) && isset($toSort[$keys[$key['order']]])) {
                $ordered[$key['order']] = $toSort[$keys[$key['order']]];
            }
        }

Let me know if this is a step in the right direction or not doing what is intended.

thanks,
Rowan

 

#3

BoldMinded (Brian)

Oct 18, 2022

So that array format is very different than what I have locally in EE 7, which is working just fine. My gut tells me this is something that changed in how EE handles the format of the React fields. Since you’re running EE 5, which I dropped support for awhile back, you’ll have to upgrade to at least EE 6 before I can investigate this further. If that code fix works for you then by all means keep using it. But once you upgrade you should try it without that hack and see what happens. If the issue still occurs after upgrading, refer to this ticket when making a new ticket.

Login to reply