Archived topic
GeneratePress, GP Premium and PHP 8.1
6 replies · Started by Michael on November 14, 2022
Hi there
As of today, are GeneratePress and GP Premium fully compatible with PHP 8.1 or what is the current status?
Thanks a lot
Michael
Hi there,
Hard to put a figure on it but i would say 99.99%.
Reason i say that, is our compatibility is based on coding to WP Standards. So when WP works fine with PHP 8.1 so should GP.
But WP 6.1 introduced a lot of changes, which included some code deprecations as well as some oversights in what output we expect from their code.
For example - see here:
https://generatepress.com/forums/topic/deprecated-code-for-php-8-1/#post-2412066
We have had a couple of users report server log warnings ( not errors and no critical errors ) - and in most of these cases it is where a WP function isn't returning whats expected. So that results in us having to do a little patchwork.
For me personally, i have been running 8.1 on several sites.
And the only ones i haven't switched are due to plugins that just are not compatible.
Hi there, I get a Fatal Error with PHP 8.1 and GP Pro when entering in Backend to the Elements Tab.
[16-Nov-2022 17:07:40 UTC] PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given in /wp-content/themes/generatepress/inc/structure/post-meta.php:520
Stack trace:
#0 /wp-content/themes/generatepress/inc/structure/post-meta.php(520): in_array(false, false)
#1 /wp-includes/class-wp-hook.php(308): generate_add_post_meta(Object(WP))
#2 /wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#3 /wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#4 /wp-includes/class-wp.php(797): do_action_ref_array('wp', Array)
#5 /wp-includes/functions.php(1332): WP->main(Array)
#6 /wp-admin/includes/post.php(1245): wp(Array)
#7 /wp-admin/includes/class-wp-posts-list-table.php(165): wp_edit_posts_query()
#8 /wp-admin/edit.php(235): WP_Posts_List_Table->prepare_items()
#9 {main}
thrown in /wp-content/themes/generatepress/inc/structure/post-meta.php on line 520
[16-Nov-2022 17:07:40 UTC] PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given in /wp-content/themes/generatepress/inc/structure/post-meta.php:520
Stack trace:
#0 /wp-content/themes/generatepress/inc/structure/post-meta.php(520): in_array('post', false)
#1 /wp-includes/class-wp-hook.php(308): generate_add_post_meta(Object(WP))
#2 /wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#3 /wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#4 /wp-includes/class-wp.php(797): do_action_ref_array('wp', Array)
#5 /wp-includes/functions.php(1332): WP->main('')
#6 /wp-blog-header.php(16): wp()
#7 /index.php(17): require('/www/htdocs/s01...')
#8 {main}
thrown in /wp-content/themes/generatepress/inc/structure/post-meta.php on line 520
Hi there,
do you have any Elements saved in your Appearance > Elements ?
Thanks David - waiting for GravityForms and Yoast SEO to be compatible as well.
Thanks David, its now working.
You're welcome