In Content Blocks, when trying to create a new template, or edit an existing one, the Build Template function is not working [it just sticks at “Loading Data”] and something is causing a 500 error when I attempt to use it:
When you switch to the “Network” tab in the developer console.
What are the request-parameters of the request that fails (especially the “action”) and is there some error message in the response?
As ContentBlocks is a paid extra, maybe try to contact modmore directly or use their specific forum.
I don’t have a version of ContentBlocks running on MODX 3 and PHP 8.1, so I can’t say if this is a general problem or something specific to your installation.
Can you check your servers’ error log? It’s certainly not supposed to throw a 500 error on that URL, but it’s a bit hard to see why that would happen without the detailed error. Could be a compatibility issue but also a custom input type that breaks it, for example.
Thanks - the server php error_log files aren’t registering anything on this event. I agree you’d think that detail on the error must be logged somewhere but I cannot find it.
I don’t have any custom input types but I have created custom Layouts and Fields.
These all work great. It’s just on clicking the “Build Template” button that I get the problem.
Do you know what it’s retrieving exactly on the action: mgr/template_builder/getvars … ?
Not sure if it’s at all relevant - but every time I visit the Manager Actions page [not the error log] I get multiples of errors in the Manager Error Log file along these lines:
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbTemplate from mysql.cbtemplate
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1675) Could not load class cbTemplate!
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbTemplate from mysql.cbtemplate
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 786) cbTemplate::load() is not a valid static method.
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbLayout from mysql.cblayout
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1675) Could not load class cbLayout!
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbLayout from mysql.cblayout
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 786) cbLayout::load() is not a valid static method.
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbLayout from mysql.cblayout
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1675) Could not load class cbLayout!
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbLayout from mysql.cblayout
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 786) cbLayout::load() is not a valid static method.
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbLayout from mysql.cblayout
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1675) Could not load class cbLayout!
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbLayout from mysql.cblayout
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 786) cbLayout::load() is not a valid static method.
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbLayout from mysql.cblayout
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1675) Could not load class cbLayout!
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbLayout from mysql.cblayout
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 786) cbLayout::load() is not a valid static method.
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbCategory from mysql.cbcategory
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1675) Could not load class cbCategory!
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbCategory from mysql.cbcategory
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 786) cbCategory::load() is not a valid static method.
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbField from mysql.cbfield
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1675) Could not load class cbField!
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: cbField from mysql.cbfield
[2022-06-28 18:33:19] (ERROR @ /home/xxyyzz/2022/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 786) cbField::load() is not a valid static method.
I think these are only generated when visiting that page.
In addition - the following errors are generated when saving some content-blocks-enabled Resources, but not others:
[2022-06-28 15:52:02] (ERROR @ /home/xxyyzz/2022/core/components/contentblocks/model/contentblocks/contentblocks.class.php : 596) [ContentBlocks] Could not find input 0 for parsing.
[2022-06-28 15:52:37] (ERROR @ /home/xxyyzz/2022/core/components/contentblocks/model/contentblocks/contentblocks.class.php : 596) [ContentBlocks] Could not find input 0 for parsing.
[2022-06-28 15:53:46] (ERROR @ /home/xxyyzz/2022/core/components/contentblocks/model/contentblocks/contentblocks.class.php : 596) [ContentBlocks] Could not find input 0 for parsing.
[2022-06-28 15:53:58] (ERROR @ /home/xxyyzz/2022/core/components/contentblocks/model/contentblocks/contentblocks.class.php : 596) [ContentBlocks] Could not find input 0 for parsing.
Again possibly not relevant.
None of the above errors are generated when trying to “Build Content”.
Hmm I’m not able to replicate the problem. I’m also using PHP 8.1, MODX 3.0.1.
That’s very strange if nothing’s showing up in the PHP logs - it should do for a 500 error.
Have you got the server set to log to the one location? I know with some hosts (cPanel for example) they leave log files all through the directory structure depending on where the error occurred.
Thanks @digitalpenguin - everything worked fine for me too - until it didn’t! I just don’t know what I’ve done to break it.
Yep - I don’t understand this either. I can search the MODX directory - there are three error_log files:
But none of these are getting updated on this 500 error.
I might ask my hosts if they can help track down the detail of the error.
Hmm … it’s set to 0 and always has been but I think that’s the right track.
I’ve worked out that the “could not find input” error occurs when I save a resource which contains the default layout [Full Width] - so a brand new page, with no content, as below, will register that error whenever it’s saved:
PHP Fatal error: Uncaught Error: Call to a member function get() on null in /home/xxyyzz/core/cache/includes/elements/modx/revolution/modsnippet/92.include.cache.php:2
This error didn’t appear until I enabled debugging.
I’ve removed the context-related code from the snippet [it’s a single context site] and all seems to be back to normal!
Thanks everyone for your time
The [ContentBlocks] Could not find input 0 for parsing error remains but I don’t believe it is causing problems at the moment.