2.0.4 breaks compatibility with php 5.6
-
Hello,in a recent update in 2.0;4 the use of the null coalescing operator breaks compatibility with php 5.6 (and breaks the site incidentally)
I have a bunch of sites living on a server that is stuck in an old php version, 5.6, the sites can’t be migrated elsewhere because my customer is contractually forced to use their company internal hosting provider. And the company internal hosting provider is not upgrading php versions on this server (flats out refuses to. Yeah I know, we’ve all had to face stupid corporate IT but i assure you this one is near the op of the moronic category).
Nonetheless, the problem lies in /wp-content/themes/oceanwp/inc/third/class-gutenberg.php on line 313 to 318 :
the code that breaks is this :$headings = get_theme_mod('headings_typography')['color'] ?? $default_color; $post_title = get_theme_mod('blog_post_title_typography')['color'] ?? $default_color; $heading_h1 = get_theme_mod('heading_h1_typography')['color'] ?? $default_color; $heading_h2 = get_theme_mod('heading_h2_typography')['color'] ?? $default_color; $heading_h3 = get_theme_mod('heading_h3_typography')['color'] ?? $default_color; $heading_h4 = get_theme_mod('heading_h4_typography')['color'] ?? $default_color;
the ?? ioperator only appeared in php 7.0
replacing those lines with this :
$headings = isset(get_theme_mod('headings_typography')['color']) ? get_theme_mod('headings_typography')['color'] : $default_color; $post_title = isset(get_theme_mod('blog_post_title_typography')['color']) ? get_theme_mod('blog_post_title_typography')['color'] : $default_color; $heading_h1 = isset(get_theme_mod('heading_h1_typography')['color']) ? get_theme_mod('heading_h1_typography')['color'] : $default_color; $heading_h2 = isset(get_theme_mod('heading_h2_typography')['color']) ? get_theme_mod('heading_h2_typography')['color'] : $default_color; $heading_h3 = isset(get_theme_mod('heading_h3_typography')['color']) ? get_theme_mod('heading_h3_typography')['color'] : $default_color; $heading_h4 = isset(get_theme_mod('heading_h4_typography')['color']) ? get_theme_mod('heading_h4_typography')['color'] : $default_color; $heading_tag = get_theme_mod('ocean_single_post_heading_tag', 'h2');
Fixes the problem.
The Worpress core itself is supposed to work with legacy environment from php 5.6.20+
(see https://make.www.ads-software.com/hosting/handbook/handbook/server-environment/#php) although of course they strongly advise against it. In any case I’m quite stuck here, i’ve got about 9 sites on this server all running with OceanWP theme.For now I’ve reverted the change with the code above and disabled automatic themes updates (but I really don’t like to keep old version, i try to jkeep the sites theme and plugins up to date even though I can’t do anythin about the PHP version)
Do you think you could restore the php5.6.20 compatibility ?
- The topic ‘2.0.4 breaks compatibility with php 5.6’ is closed to new replies.