Tagged: Compatibility Issue, PHP version, wordpress update
-
AuthorPosts
-
November 22, 2024 at 2:39 pm #1471937
I hope this message finds you well. I am reaching out regarding an issue I am encountering with the Enfold Builder after updating to PHP 8.2 and WordPress 6.7. While I understand that the support period for my license has expired, I wanted to share the details of the problem in case you can provide any guidance or a recommended course of action.
Upon attempting to use the builder, it crashes with the following errors:
Issue 1:
File: class-template-builder.php
Line: 2604
Code:if (is_array($box) && isset($box['id']) && $box['id'] == $slug) {
Error Message:
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /code/wp-content/themes/enfold/config-templatebuilder/avia-template-builder/php/class-template-builder.php:2604
Issue 2:
File: class-meta-box.php
Line: 172
Code:if (isset($box['page']) && is_array($box['page'])) { foreach ($box['page'] as $area) {
Given these errors, it seems the code may not be fully compatible with the newer PHP and WordPress versions. If an update is available or a patch could address this, I would greatly appreciate any assistance or direction you could provide.
Thank you for taking the time to review this matter. I appreciate your help and understanding.
Thank You
Adeel Nazar
November 22, 2024 at 3:50 pm #1471947Hey seemeconsulting,
Which version of the theme are you running?
Best regards,
RikardNovember 22, 2024 at 4:38 pm #1471957Theme Version is 6.0.6
November 23, 2024 at 12:48 pm #1471997Hi,
Please send us a temporary WordPress admin login and login URL so that we can have a closer look. You can post the details in the Private Content section of your reply.
Best regards,
RikardNovember 28, 2024 at 3:52 pm #1472513This reply has been marked as private.November 28, 2024 at 5:59 pm #1472531Hi,
Thanks for that. It looks like the default WordPress login URLs are not working, please share the login URL as well.
Best regards,
RikardNovember 29, 2024 at 12:42 pm #1472575This reply has been marked as private.November 29, 2024 at 5:40 pm #1472591Hi,
Thanks for that. What happens if you temporarily activate the parent theme, or deactivate all plugins?
Best regards,
RikardDecember 2, 2024 at 10:44 am #1472693After updating my PHP version from 7.3 to 8.2, I encountered a couple of issues with the theme due to type-related incompatibilities. These errors seem to arise from stricter type handling introduced in PHP 8.2 and primarily involve missing checks for variable types and proper initialization.
Errors Encountered
In class-template-builder.php at line 2604, within the apply_editor_wrap() method:Fatal Error:
Fatal error: Uncaught TypeError: Cannot access offset of type string on stringif( $box['id'] == $slug )
Suggested Fix:
if ( is_array( $box ) && isset( $box['id'] ) && $box['id'] == $slug )
In class-meta-box.php:
Fatal Error: Attempting to access an offset of type string on a string variable.
Warnings: Trying to access array offsets on a boolean value.
These issues occur due to uninitialized or improperly set variables. For example, the following line is problematic:if( in_array( $_POST['post_type'], $default_box['page'] ) )
Suggested Fixes:
if ( isset( $_POST['post_type'] ) && isset( $default_box['page'] ) && is_array( $default_box['page'] ) ) { if ( in_array( sanitize_text_field( $_POST['post_type'] ), $default_box['page'] ) ) { $must_check = true; } }
These changes involve adding type checks and sanitizing inputs, ensuring compatibility with PHP 8.2 while maintaining the theme’s functionality. They are straightforward adjustments that enhance the theme’s robustness across PHP versions.
If you’d like, I can share the exact code changes I made to resolve these issues. Could you kindly incorporate these fixes into the next update to ensure compatibility for all users?
Thank you for your continued support, and please let me know if you need any additional details.
December 2, 2024 at 1:03 pm #1472705 -
AuthorPosts
- You must be logged in to reply to this topic.