I am trying to upgrade my upgrade my website to php 8.1. I get a fatal error message that goes away when I turn off Toolset Views.
Link to a page where the issue can be seen: hidden link
I expected to see: the homepage images and text.
Instead, I got: the error message you see if you look at the link. hidden link

Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
That's rather strange.
Even if I edit the page and remove the Views, it still shows the error when visiting the page.
I need to take a deeper look to understand what's going wrong.
Is it okay if I copy the site to work on locally?
Yes, sure. Thanks! My tech guy did the testing, and he said when he removed Views the fatal error went away, but maybe he is wrong.

Mateus Getulio
Supporter
Languages:
English (English )
Timezone:
America/Sao_Paulo (GMT-03:00)
Hello there,
We proceeded with some tests and checked that the issue stopped if we temporarily commented this line in the view:
<p class="tocimage"><a href="[types field='url-latest' output='raw'][/types]">[types field='sm-homepage-image' title='%%TITLE%%' alt='%%ALT%%' size='full'][/types]</a></p>
The issue is more specifically related with the field: sm-homepage-image.
Trying to edit one of the posts loaded in the loop throws the error as well: hidden link
Given this is a staging environment, before taking a local copy of your site, I took the liberty of testing on minimal minimal, with default theme and only Toolset plugins enabled, and the issue happens as well.
However, after I tried to re-enable the theme 'Dynamik-Gen' it started showing this error and having issues with the style in the front end:
Fatal error: Uncaught Error: Call to undefined function create_function() in /wp-content/uploads/dynamik-gen/theme/custom-functions.php
It looks like this is related to some generated content in the wp-uploads folder. After switching themes, there might me some steps we don't know in order for theme to work properly.
Can you please review it and restore the site's theme? We'll proceed with working locally after it is corrected.
I apologize for the inconvenience.
Thank you,
Mateus
Okay, we have fixed the theme. If you switch to another theme, make a copy of custom-functions.php in wp-content\uploads\dynamik-gen\theme\ before you switch and then replace it when you switch back. That should help.

Mateus Getulio
Supporter
Languages:
English (English )
Timezone:
America/Sao_Paulo (GMT-03:00)
Hi,
I have escalated this ticket to our 2nd tier of support where our 2nd tier specialists will take a deeper look at this issue and will try to find a solution.
I will get back to you as soon as I get an answer from them.
Best regards,
Mateus

Mateus Getulio
Supporter
Languages:
English (English )
Timezone:
America/Sao_Paulo (GMT-03:00)
Hello,
We've identified that the issue is due to a custom uploads location being used on your server, which causes a specific error in the Toolset plugin. We've implemented a workaround on your site that resolves the problem. Please test it again and confirm it.
The workaround involves editing the code at plugins/toolset-blocks/vendor/toolset/toolset-common/inc/autoloaded/utils/Attachments.php, replacing this at line 67-68:
// Split the $url into two parts with the upload directory as the separator.
$parsed_url = explode( wp_parse_url( $this->get_base_upload_directory(), PHP_URL_PATH ), $url );
with:
$wp_parsed_url = wp_parse_url( $this->get_base_upload_directory(), PHP_URL_PATH );
$parsed_url = is_string($wp_parsed_url) ? explode( $wp_parsed_url, $url ) : null;
While we're planning to include this fix in an upcoming version of Toolset, there's a possibility that it might not be ready in time for the next release. In that case, you may need to reapply the workaround after any future updates until the fix is officially included.
Please let us know if you need further assistance.
Thank you, Mateus