• Resolved shimist

    (@shimist)


    The host’s php version is 8.1.
    The WordPress version is 6.8.3

    WooCommerce 10.3.5


    But this error is shown in debug.log

     PHP Deprecated:  str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/***/public_html/wp-includes/shortcodes.php on line 246

    I deactivated all plugins and then activated only WooCommerce
    And this error turned out to be from WooCommerce.
    When I deactivate WooCommerce this error does not appear.
    Can you help me to solve this problem or update WooCommerce to fix this problem?

    • This topic was modified 6 months, 3 weeks ago by shimist.
Viewing 14 replies - 16 through 29 (of 29 total)
  • Thread Starter shimist

    (@shimist)

    Yes, these are exactly the widgets of WooCommerce itself, whose names I told you in the previous post.
    In this path
    woocommerce\includes\widgets

    Hi @shimist,

    Great to hear back from you and I appreciate you confirming that these are the default WooCommerce widgets. This helps us narrow things down more confidently and continue checking what might be triggering the deprecated notice you are seeing.

    When you can, please share your full WooCommerce system status report so we can review your site’s environment and plugin/theme setup. You can copy it from WooCommerce, Status, then paste it into https://pastebin.com and share the generated link here. This will help us check for anything out of place and guide you more accurately.

    Thread Starter shimist

    (@shimist)

    @lovingbro

    https://pastebin.com/5FCWsRs7
    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    Thank you for sharing the system status report. Currently, everything appears fine in the report.

    Could you please record a short video showing how you are adding the WooCommerce widget and exactly when the error is triggered? We are trying to replicate the issue on our test site but haven’t been able to reproduce it yet. You may use Loom or Awesome Screenshot to create the video.

    Once we have the steps to replicate the issue, we can further assist you or escalate it to our developers if we are able to reproduce it.

    Thread Starter shimist

    (@shimist)

    To install the widget, from the WordPress dashboard and the widgets section, I drag the widget to the desired section.!!!

    Hi @shimist,

    Thank you for the update. The detail you found about the issue appearing only when clicking product links inside the WooCommerce widgets is very helpful. To narrow this down properly, I need a bit more information so I can try to reproduce your exact setup.

    1. Please share the exact settings you are using for the WooCommerce Products widget and the Recently Viewed Products widget. You can send a screenshot or list the values you entered in the widget fields (title, number of products, filters, order, etc.).
    2. Please confirm what type of product you are clicking when the notice appears. For example, is it a simple product, a variable product, or something else? Also let me know if the product has an empty short description or contains any shortcode inside the description or additional tabs.

    Once I have these details, I will attempt to recreate the same conditions on a clean test installation. If we can reproduce the behaviour, I will escalate this internally so our developers can investigate it further.

    Thanks again for your patience while we track this down.

    Thread Starter shimist

    (@shimist)

    Hi @saivutukuru

    Both simple and variable products
    The widget only has a link to the product with a small image of it

    Hi @shimist,

    Thank you for sharing this update. I have taken some time to test this on my end using a clean site with the Twenty Twenty-Five theme, and based on what I’m seeing, this theme does not support classic widgets at all. Going back to your system status report, your site is indeed running Twenty Twenty-Five, which confirms that the default WordPress widget area should not be available there.

    Because of this, I would love to clarify which theme you were using when you took the screenshot you just shared. This will help us understand whether the widget panel you are seeing is coming from a different theme or perhaps from a third-party plugin that adds widget-like options.

    When you can, please also send us a short Loom video showing the steps you take to add the widget. This will give us a clearer view of what appears on your screen and at what point you see the deprecated notice. You can use https://loom.com or any similar tool you prefer.

    Plugin Support thelmachido a11n

    (@thelmachido)

    It’s been a while since we heard back from you for this reason we are closing this thread. 

    If WooCommerce has been useful for your store and you appreciate the support you’ve received, we’d truly appreciate it if you could leave us a quick review here: 

    https://ww.wp.xz.cn/support/plugin/woocommerce/reviews/#new

    Thread Starter shimist

    (@shimist)

    @lovingbro
    Hi,

    I get this error when I use this widget with the Jannah theme.
    I asked the theme author about the error and this is the answer
    Jannah does not use the str_contains function in any of its code. Additionally, the Product List and Latest Viewed Products widgets do not belong to the theme.

    So what’s the problem?

    Hi @shimist,

    I appreciate you taking the time to share this update, and it is great that you also checked with the Jannah theme author. That context really helps us understand what you are seeing more clearly and continue narrowing things down with you.

    The next thing that would be helpful is confirming whether you have tried switching to a different theme, even just temporarily, to see if the deprecated notice still appears when using the WooCommerce widget. This will let us know if the behaviour is only happening when Jannah is active or if it occurs under other themes as well. Themes can sometimes override or filter how widget output is handled, which may lead to unexpected behaviour with PHP functions even if the theme itself does not use that function directly.

    Please let me know if you have tested this with another theme like Twenty Twenty-Four or Storefront and whether the same message appears. That information will give us a clearer direction on what to check next.

    Looking forward to your update on this so we can continue digging into it together.

    Thread Starter shimist

    (@shimist)

    @lovingbro @thelmachido @saivutukuru @shahzeenfarooq

    Dear friends
    I found the main cause of the error.
    All products that have empty product short description section when we open them (from widget or refresh the link itself)
    That error occurs. (PHP Deprecated: str_contains(): Passing null to parameter #1 ($haystack))

    WooCommerce 10.4.0
    WordPress: 6.9
    php:8.1


    But products that have short description do not occur any error.
    Please give me the code to solve this problem

    Thank you.

    • This reply was modified 6 months ago by shimist.

    Hi @shimist,

    Thank you for following up and sharing your observations with us. I understand that when you open products without a short description, the error gets logged, but products with a short description don’t trigger the error, this is helpful to know.

    To better assist you, I need a bit more clarity: when you say you “open from the widget,” are you referring to a product block, or is this widget added via a third-party plugin? Could you also share a screenshot of the widget area you’re referring to?

    Plugin Support Feten L. a11n

    (@fetenlakhal)

    Hi there,

    We haven’t heard back in a bit, so I’ll go ahead and mark this as resolved for now. If you’d like to pick things back up later, we’re just a message away!

Viewing 14 replies - 16 through 29 (of 29 total)

You must be logged in to reply to this topic.