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: Some channel entries display fatal error, some do not. Uncaught TypeError: Return value of Bloqs\Model\BlockDefinition::getShortName() must be of the type string
Status | Resolved |
Add-on / Version | Bloqs 4.9.1 |
Severity | |
EE Version | 5.4.2 |
Paul Larson
Oct 20, 2021Full text of error.
Fatal error: Uncaught TypeError: Return value of BoldMinded\Bloqs\Model\BlockDefinition::getShortName() must be of the type string, null returned in /mydomain/system/user/addons/bloqs/Model/BlockDefinition.php:331 Stack trace: #0 /mydomain/system/user/addons/bloqs/Controller/PublishController.php(461): BoldMinded\Bloqs\Model\BlockDefinition->getShortName() #1 /mydomain/system/user/addons/bloqs/Controller/PublishController.php(114): BoldMinded\Bloqs\Controller\PublishController->createBlockDefinitionsVars() #2 /mydomain/system/user/addons/bloqs/ft.bloqs.php(294): BoldMinded\Bloqs\Controller\PublishController->displayField() #3 /mydomain/system/ee/legacy/fieldtypes/EE_Fieldtype.php(326): Bloqs_ft->display_field() #4 /mydomain/system/ee/legacy/libraries/api/Api_channel_fields.php(410): EE_Fieldtype->display_publish_field() #5 /mydomain/system/ee/EllisLa in /mydomain/system/user/addons/bloqs/Model/BlockDefinition.php on line 331
The error is only thrown on some entries. I’ll follow up with screenshots of the config of the bloq for this channel.
Paul Larson
Oct 20, 2021
Actually, the problem is limited to one channel.
A Ha, the field (editing / viewing the bloq settings in EE) throws this error. Likely same as before, but it’s not entry content that triggers it, but the field itself.
Fatal error: Uncaught TypeError: Return value of BoldMinded\Bloqs\Model\BlockDefinition::getName() must be of the type string, null returned in /mydomain/system/user/addons/bloqs/Model/BlockDefinition.php:350 Stack trace: #0 /mydomain/system/user/addons/bloqs/ft.bloqs.php(720): BoldMinded\Bloqs\Model\BlockDefinition->getName() #1 /mydomain/system/ee/legacy/libraries/api/Api_channel_fields.php(410): Bloqs_ft->display_settings() #2 /mydomain/system/ee/EllisLab/ExpressionEngine/Model/Content/FieldFacade.php(226): Api_channel_fields->apply() #3 /mydomain/system/ee/EllisLab/ExpressionEngine/Model/Content/FieldModel.php(72): EllisLab\ExpressionEngine\Model\Content\FieldFacade->getSettingsForm() #4 /mydomain/system/ee/EllisLab/ExpressionEngine/Controller/Fields/Fields.php(578): EllisLab\ExpressionEngine\Model\Content\FieldModel->getSettingsForm() #5 /var/www/vhosts/mgcdiagnostics.c in /mydomain/system/user/addons/bloqs/Model/BlockDefinition.php on line 350
BoldMinded (Brian)
Oct 20, 2021
Did you recently delete any bloqs? What actions have been performed recently when updating, creating, or deleting bloqs?
BoldMinded (Brian)
Oct 20, 2021
You’re using EE5…. technically I dropped support of EE 5 when 6.1 was released.
Paul Larson
Oct 20, 2021
It might have been because the site relies on cloning, so we are stuck on upgrading to EE6.
BoldMinded (Brian)
Oct 20, 2021
What about my questions though? Did you recently delete any bloqs? What actions have been performed recently when updating, creating, or deleting bloqs?
Paul Larson
Oct 20, 2021
The bloq fields haven’t been changed from the live site in quite some time. Issue exists on the live site too, we’ve discovered. So no changes (rarely have we had to administer or modify the site in months).
Going to try an EE6 upgrade on dev, though. Now that I look I can’t see any module upgrade that is preventing that.
BoldMinded (Brian)
Oct 20, 2021
In this case upgrading to 6 probably won’t fix the error b/c it’s failing trying to get a name value from the block definition object, which should very much exist. Why the name property is not on the block definition object is puzzling. I can’t think of a reason why the name wouldn’t be available. If you look at the exp_blocks_blockdefinition table does every block have a value in the name and short name column?
Paul Larson
Oct 20, 2021
Comment has been marked private.
Paul Larson
Oct 20, 2021
The above screenshot is on the entry. Navigating to the EE Field (bloq) to edit yields this.
TypeError Caught
Return value of BoldMinded\Bloqs\Model\BlockDefinition::getShortName() must be of the type string, null returned
user/addons/bloqs/Model/BlockDefinition.php:331
Stack Trace: Please include when reporting this error
#0 user/addons/bloqs/ft.bloqs.php(721): BoldMinded\Bloqs\Model\BlockDefinition->getShortName()
#1 ee/legacy/libraries/api/Api_channel_fields.php(377): Bloqs_ft->display_settings()
#2 ee/ExpressionEngine/Model/Content/FieldFacade.php(257): Api_channel_fields->apply()
#3 ee/ExpressionEngine/Model/Content/FieldModel.php(68): ExpressionEngine\Model\Content\FieldFacade->getSettingsForm()
#4 ee/ExpressionEngine/Controller/Fields/Fields.php(547): ExpressionEngine\Model\Content\FieldModel->getSettingsForm()
#5 ee/ExpressionEngine/Controller/Fields/Fields.php(394): ExpressionEngine\Controller\Fields\Fields->form()
#6 [internal function]: ExpressionEngine\Controller\Fields\Fields->edit()
#7 ee/ExpressionEngine/Core/Core.php(255): call_user_func_array()
#8 ee/ExpressionEngine/Core/Core.php(111): ExpressionEngine\Core\Core->runController()
#9 ee/ExpressionEngine/Boot/boot.php(161): ExpressionEngine\Core\Core->run()
#10 httpdocs/admin.php(144): require_once(’...’)
#10 httpdocs/admin.php(144): require_once(’...’)
Paul Larson
Oct 20, 2021
Comment has been marked private.
BoldMinded (Brian)
Oct 20, 2021
You’re going to have to so some debugging. This seems like an issue where a block was assigned to a field and then removed at some point? On line 718 of ft.bloqs.php is this line:
foreach ($blockDefinitions as $blockDefinition) {
change it to:
What version of PHP are you using??
Paul Larson
Oct 20, 2021
Comment has been marked private.
BoldMinded (Brian)
Oct 20, 2021
What does your exp_blocks_blockfieldusage table look like?
BoldMinded (Brian)
Oct 20, 2021
Can you run this query on your db and share the results? You can export the results as a csv if you can’t fit it all in a screenshot.
Paul Larson
Oct 20, 2021
Comment has been marked private.
BoldMinded (Brian)
Oct 20, 2021
What about this query? You’ll need to change :fieldId to whatever the int value is for the field you’re editing.
Paul Larson
Oct 20, 2021
Attached `WHERE bfu.field_id = 27`
https://www.dropbox.com/s/1eal5nsclel5kh4/bd-2.csv?dl=0
BoldMinded (Brian)
Oct 20, 2021
Ok, those last 2 rows have null values… thats our problem. Now to figure out how that happened.
BoldMinded (Brian)
Oct 20, 2021
What does the exp_blocks_blockfieldusage table look like?
Paul Larson
Oct 20, 2021
BoldMinded (Brian)
Oct 20, 2021
Ok… see that row 2/3 of the way down with blockdefinitin_id of 0? Backup your database then manually delete that row. Not entirely sure how that became to be, but it looks like a bad record. I haven’t seen that behavior before.
I’m wondering if this clears up the other javascript issue you were experiencing too. Delete that row and report back :D
Paul Larson
Oct 20, 2021
Sadly I think it’s still the same error..
BoldMinded (Brian)
Oct 20, 2021
Run that last query again where you added the fieldId of 27. I want to see if there is still a NULL row in the result.
Paul Larson
Oct 20, 2021
Here ya go
https://www.dropbox.com/s/evf4gpb17ocp0s3/exp_blocks_blockfieldusage.csv?dl=0
BoldMinded (Brian)
Oct 20, 2021
Check the exp_blocks_atomdefinition table, there might be a row in there with another 0, maybe for blockdefintion_id column. If so delete that row too.
Paul Larson
Oct 20, 2021
exp_blocks_atomdefinition
No ‘0’, but also worth noting I DON’T see the short name of the filename in question, product_tabs-block. (might not be a concern)
———
BoldMinded (Brian)
Oct 20, 2021
Is that a block/atom you expect to still exist?
BoldMinded (Brian)
Oct 20, 2021
I’m going to be honest, I’m not sure what state the site is supposed to be in, or how it got to its current state. Something in those db tables isn’t matching up so the query is returning that null row, which is causing the error.
Paul Larson
Oct 20, 2021
Comment has been marked private.
BoldMinded (Brian)
Oct 21, 2021
Paul, are you able to provide CP access to the dev site so I can look at the DB directly instead of going back and forth?
Paul Larson
Oct 21, 2021
Comment has been marked private.
BoldMinded (Brian)
Oct 21, 2021
Paul, can you edit the ticket and use the provided fields for the url, user and pass? When the ticket is closed it is deleted form the database. I don’t want sensitive login info to stay in comments.
Paul Larson
Oct 21, 2021
Sure! Think I did it right? (was on phone so probably didn’t see the option to edit the ticket)
BoldMinded (Brian)
Oct 21, 2021
What page in the control panel do I need to go to see the error? Including the JS errors reported in the other ticket?
BoldMinded (Brian)
Oct 21, 2021
I removed the var_dump on your dev site, and the field isn’t throwing anymore errors. I think this row was the culprit
The block definition of 13 was removed at some point but this row stuck around. Removing this row and that other null row from earlier seems to have cleared up the issue. I went to a product’s entry and didn’t see any JS errors either (referring to the other ticket). If you’re still getting JS errors lets close this ticket and move the conversation to the other ticket.
Paul Larson
Oct 21, 2021
Sorry, was in a meeting! This is great news. The /products channel was where the error was thrown. Seems to be gone now. Huzzah!
I’ll respond about the other ticket.