Publisher does not support the Fluid field type. 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: Unexpected Error on save - loss of data

Status Resolved
Add-on / Version Bloqs 4.6.0
Severity
EE Version 6.0.3

Stephen Galbraith

Mar 02, 2021

I just spent an evening building an entry with Bloqs (saving as I went along). However, near the end I was getting a field validation error (just red around the input). When I fixed it and went to save, the error below appeared.

My only ideas are there was some issue with how many Bloqs existed in the one entry.

The only other thing I could look at was the database itself and saw that the “field_id_38” column in the “exp_channel_data_field_38” table does not seem to hold all of the block data that was inputted.

The error only appears on this entry, so unless there is someway to rebuild the field - I may just have to restart the entry over and perhaps split it up somehow.

Argument 2 passed to BoldMinded\Bloqs\Controller\PublishController::renderBlock() must be an instance of BoldMinded\Bloqs\Model\Block, array given, called in user/addons/bloqs/Controller/PublishController.php on line 249

user/addons/bloqs/Controller/PublishController.php:184

Stack Trace: Please include when reporting this error

#0 user/addons/bloqs/Controller/PublishController.php(249): BoldMinded\Bloqs\Controller\PublishController->renderBlock(‘76’, Array)
#1 user/addons/bloqs/Controller/PublishController.php(249): BoldMinded\Bloqs\Controller\PublishController->renderBlock(‘76’, Object(BoldMinded\Bloqs\Model\Block))
#2 user/addons/bloqs/Controller/PublishController.php(249): BoldMinded\Bloqs\Controller\PublishController->renderBlock(‘76’, Object(BoldMinded\Bloqs\Model\Block))
#3 user/addons/bloqs/Controller/PublishController.php(101): BoldMinded\Bloqs\Controller\PublishController->renderBlock(‘76’, Object(BoldMinded\Bloqs\Model\Block))
#4 user/addons/bloqs/ft.bloqs.php(285): BoldMinded\Bloqs\Controller\PublishController->displayField(‘76’, Array, Array)
#5 ee/legacy/fieldtypes/EE_Fieldtype.php(320): Bloqs_ft->display_field(‘Food|Breakfast|...’)
#6 ee/legacy/libraries/api/Api_channel_fields.php(377): EE_Fieldtype->display_publish_field(‘Food|Breakfast|...’)
#7 ee/ExpressionEngine/Model/Content/FieldFacade.php(250): Api_channel_fields->apply(‘display_publish…’, Array)
#8 ee/ExpressionEngine/Model/Content/Display/FieldDisplay.php(70): ExpressionEngine\Model\Content\FieldFacade->getForm()
#9 ee/ExpressionEngine/View/publish/partials/publish_form.php(83): ExpressionEngine\Model\Content\Display\FieldDisplay->getForm()
#10 ee/ExpressionEngine/Service/View/View.php(137): include(’...’)
#11 ee/ExpressionEngine/Service/View/View.php(106): ExpressionEngine\Service\View\View->parse(’...’, Array)
#12 ee/ExpressionEngine/Service/View/View.php(165): ExpressionEngine\Service\View\View->render(Array)
#13 ee/ExpressionEngine/View/publish/entry.php(5): ExpressionEngine\Service\View\View->embed(Object(ExpressionEngine\Service\View\View))
#14 ee/ExpressionEngine/Service/View/View.php(137): include(’...’)
#15 ee/ExpressionEngine/Service/View/View.php(106): ExpressionEngine\Service\View\View->parse(’...’, Array)
#16 ee/legacy/libraries/View.php(40): ExpressionEngine\Service\View\View->render(Array)
#17 ee/legacy/libraries/Cp.php(319): View->render(‘publish/entry’, Array, false)
#18 ee/ExpressionEngine/Controller/Publish/Edit.php(530): Cp->render(‘publish/entry’, Array)
#19 [internal function]: ExpressionEngine\Controller\Publish\Edit->entry(‘76’)
#20 ee/ExpressionEngine/Core/Core.php(251): call_user_func_array(Array, Array)
#21 ee/ExpressionEngine/Core/Core.php(111): ExpressionEngine\Core\Core->runController(Array)
#22 ee/ExpressionEngine/Boot/boot.php(161): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
#23 admin.php(154): require_once(’...’)
#23 admin.php(154): require_once(’...’)

#1

BoldMinded (Brian)

You make is sound like there are a lot of Bloqs, but did it provide any details on that. Mind sharing a screenshot? Count the number of Bloqs and total number of atoms/fields in all the Bloqs too.

When did this error occur? You said after you fixed a validation error… did you re-save at this point? A video of this occurring would help me understand.

#2

Stephen Galbraith

Comment has been marked private.

#3

BoldMinded (Brian)

The error is happening when trying to display the field, so it might have saved fine, it’s just not displaying it correctly. If that is the case the error should happen every time you load this entry. Is that the case? Apparently it thinks a child of a bloq is not an actual bloq, but an array. I’m going to need more info on this. On line 246 of PublishController, there is an if statement. Change it to this:

if ($block->hasChildren()) {
            // Do not use getChildren() here...
            foreach ($block->children as &$child) {
                if (is_array($child)) {
                    echo '<pre>'; var_dump($block); die;
                }
                $child = $this->renderBlock($entryId, $child);
            }
        }

Then when the error happens send me the var_dump.

#4

Stephen Galbraith

Comment has been marked private.

#5

Stephen Galbraith

Comment has been marked private.

#6

BoldMinded (Brian)

In that foreach loop, try changing it to this:

foreach ($block->children as &$child) {
                if ($child instanceof Block) {
                    $child = $this->renderBlock($entryId, $child);
                }
            }
#7

Stephen Galbraith

Comment has been marked private.

#8

BoldMinded (Brian)

Yeah, I’m not sure how your data got into the state that it was in. Definitely let me know if you encounter the error again.

As for the number of bloqs and atoms… I’ve seen entries with 40+ bloqs, which depending on the number of atoms and quickly grow into a few hundred fields on the page. I wouldn’t recommend that 😊 Its essentially the same as adding 200+ custom fields to an entry, or 40 rows in a Grid field. The main thing to look out for in this case is PHP’s max_input_vars setting. If it’s too low and the POST array is large, it’ll truncate it and not save correctly. I’d be curious to know what your setting is currently set to.

#9

BoldMinded (Brian)

Resolved. This did seem related to the max_input_vars.

Login to reply