• In our website we’ve found a few extra deprecation warning generated from Blocksy’s code.

    Probably they depend a lot on our customizations and other installed plugins. This is the patch we’ve developed to fix them:

    diff --git a/inc/classes/screen-manager.php b/inc/classes/screen-manager.php
    index 7197a0909..00c6481a0 100644
    --- a/inc/classes/screen-manager.php
    +++ b/inc/classes/screen-manager.php
    @@ -42,10 +42,10 @@ class Blocksy_Screen_Manager {
     		}
     
     		$result = strpos(
    -			$current_template,
    +			$current_template ?? '',
     			WC()->plugin_path() . '/templates/'
     		) !== false || strpos(
    -			$current_template,
    +			$current_template ?? '',
     			get_template_directory()
     		) !== false;
     
    diff --git a/inc/components/hero-section.php b/inc/components/hero-section.php
    index 8c8c06b93..3e18067b5 100644
    --- a/inc/components/hero-section.php
    +++ b/inc/components/hero-section.php
    @@ -38,7 +38,7 @@ if (! function_exists('blocksy_get_page_title_source')) {
     			return $result;
     		}
     
    -		if (strpos($prefix, 'single') !== false || (
    +		if (strpos($prefix ?? '', 'single') !== false || (
     			function_exists('is_shop') && is_shop()
     		) && ! is_search()) {
     			$post_options = blocksy_get_post_options();
    diff --git a/inc/sidebar.php b/inc/sidebar.php
    index 0f4b1d248..20e411c88 100644
    --- a/inc/sidebar.php
    +++ b/inc/sidebar.php
    @@ -182,7 +182,7 @@ if (! function_exists('blocksy_sidebar_position_unfiltered')) {
     		]);
     
     		if (
    -			strpos($prefix, '_archive') !== false
    +			strpos($prefix ?? '', '_archive') !== false
     			||
     			$prefix === 'search'
     			||
    @@ -220,7 +220,7 @@ if (! function_exists('blocksy_sidebar_position_unfiltered')) {
     			&&
     			$prefix !== 'product'
     			&&
    -			strpos($prefix, '_single') === false
    +			strpos($prefix ?? '', '_single') === false
     			&&
     			(
     				$prefix !== 'courses_archive'
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @davefx

    Can you please confirm that you’re on the latest version of the theme? I know that our developers have fixed a bunch of these with the latest updates.

    Thanks!

    Thread Starter David Marín Carreño

    (@davefx)

    I just checked again, and only one of the three targeted deprecations had already been solved.

    This would be the correct patch for the last version of Blocksy

    diff --git a/inc/components/hero-section.php b/inc/components/hero-section.php
    index 8c8c06b93..3e18067b5 100644
    --- a/inc/components/hero-section.php
    +++ b/inc/components/hero-section.php
    @@ -38,7 +38,7 @@ if (! function_exists('blocksy_get_page_title_source')) {
     			return $result;
     		}
     
    -		if (strpos($prefix, 'single') !== false || (
    +		if (strpos($prefix ?? '', 'single') !== false || (
     			function_exists('is_shop') && is_shop()
     		) && ! is_search()) {
     			$post_options = blocksy_get_post_options();
    diff --git a/inc/sidebar.php b/inc/sidebar.php
    index 0f4b1d248..20e411c88 100644
    --- a/inc/sidebar.php
    +++ b/inc/sidebar.php
    @@ -182,7 +182,7 @@ if (! function_exists('blocksy_sidebar_position_unfiltered')) {
     		]);
     
     		if (
    -			strpos($prefix, '_archive') !== false
    +			strpos($prefix ?? '', '_archive') !== false
     			||
     			$prefix === 'search'
     			||
    @@ -220,7 +220,7 @@ if (! function_exists('blocksy_sidebar_position_unfiltered')) {
     			&&
     			$prefix !== 'product'
     			&&
    -			strpos($prefix, '_single') === false
    +			strpos($prefix ?? '', '_single') === false
     			&&
     			(
     				$prefix !== 'courses_archive'

    Thanks, I’ll pass this on to our devs and get back to you asap.

    Hi @davefx

    Can you give the latest public build a try? — 1.8.69.

    Let us know if these still happen on your end.

    Thread Starter David Marín Carreño

    (@davefx)

    Hi!

    I confirm the deprecation warnings are now solved with version 1.8.69.

    Thanks for your kind support.

    Thank you for confirming, @davefx

    Have an awesome weekend!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove extra deprecations in PHP 8.1’ is closed to new replies.