• Resolved klendathu79

    (@klendathu79)


    Hello,
    first of all, thank you for this wonderful plugin — it is greatly appreciated.

    When using PHP 8.x (tested with PHP 8.2 / 8.4), the plugin throws a fatal error that does not occur with PHP 7.4.

    Error message:
    Cannot access offset of type string on string /includes/ect-styles.php on line 174

    Cause:
    In ect-styles.php (line 174), an array offset ([...]) is accessed on a variable that is, under certain conditions, a string.
    While PHP 7.4 only raised a warning/notice, PHP 8.x treats this as a fatal error (breaking change).

    Likely affected area:
    Unvalidated access to shortcode attributes or option values (missing is_array() / isset() checks).

    Suggested fix:
    Please ensure the variable is an array before accessing offsets, e.g.:

    if (is_array($var) && isset($var['key'])) { ... }

    The issue occurs during shortcode rendering and also when saving posts (e.g. triggered via Yoast SEO hooks).

    Thank you for providing a PHP 8 compatible fix.

    Best regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Vishali Tayal

    (@vishali009)

    Hi @klendathu79,

    Thank you for reporting the issue.
    We have tested the plugin on our side with PHP 8.2 and PHP 8.4, and also checked it with the Yoast SEO plugin enabled, but we are not able to reproduce the error so far.
    Could you please let us know which specific Yoast SEO hook or functionality is triggering this issue on your end? This will help us recreate the same scenario and investigate it properly.
    If possible, please also share a screenshot or screen recording so that we can clearly understand the exact scenario and fix it more effectively.
    Thanks for your cooperation!

    I confirm same error just after update to PHP 8.2. I suggest replacing (as indicated by @klendathu79) line 174:
    $main_skin_alternate_color = $ect_title_styles1['color'];
    with:
    $main_skin_alternate_color = is_array($ect_title_styles1) ? ($ect_title_styles1['color'] ?? '#ffffff') : '#ffffff';

    This problem happens on other lines too.

    Plugin Support Jyoti Bhandari

    (@jyoti197)

    Hi @ingenyus ,

    Sorry for the inconvenience.
    As you mentioned that the same error is being triggered on your end as well, we would like to investigate this properly. But if this issue is also being triggered due to any Yoast SEO hook or specific configuration, please share detailed information with us.
    Kindly provide a screen recording, Yoast SEO settings screenshots, and details of any custom hooks (if used) that might be causing this error. This will help us recreate the exact scenario on our end and provide a proper permanent fix.
    We will do our best to resolve your issue as quickly as possible.

    Thanks & Regards
    Jyoti

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.