Skip to main content

Error "strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated"

Comments

4 comments

  • Ariel H.

    Hi Nicolae,

    Please try inserting the following code snippet after the global $template line, before your if statement:

    // Ensure $template is a string to prevent null issues
    $template = is_string($template) ? $template : '';

    This can ensure that $template is a string before being passed to strpos(), which can prevent the deprecation notice.

    Best regards,
    Ariel H.

    0
  • Nicolae Sorin Vizireanu

    Hi, Ariel,

    Not working, with the code inserted in wp-content/plugins/brizy/compatibilities/astra-addon.php. With debug activated, error disappears bu the page doesn't display correctly (printsreen below).

    I am using a template created with Brizy. With the default Astra template activated, in Brizy Template / Post Atributes, the page showing incorrectly, with incomplete width. With de Brizy Template activated it displays correctly. Everything ok with another Brizy Template & Astra default header, I don't understand. Please help. 

    Thank you,

     

    0
  • Nicolae Sorin Vizireanu

    The page tested is

    https://www.soraliaviajes.es/pagina-destino/test-2/

    0
  • KC George

    Hello Nicolae,

    In your WordPress Dashboard under Appearance- Customize - Global - Container, try these settings

    • Set the container layout to "Full Width"
    • Set the Container Style to "Unboxed"
    • Set the "Container width" and "Narrow Container Width" to highest possible values

     

    0

Please sign in to leave a comment.