• Hi,

    We’re getting quite a few of these notices …

    [19-Aug-2023 16:22:11 UTC] E_WARNING: strpos(): Empty needle in /wp-content/plugins/product-input-fields-for-woocommerce/includes/alg-wc-pif-functions.php on line 141

    Please advise.

    Many thanks,

    Oliver

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support oluisrael

    (@oluisrael)

    @domainsupport Can you please let me know the PHP version your site is running on and the WooCommerce version currently active on your site?

    Thread Starter Oliver Campion

    (@domainsupport)

    PHP v7.4.30, WooCommerce v8.0.2

    This is happening because on line 141 of /product-input-fields-for-woocommerce/includes/alg-wc-pif-functions.php

    $jqueryui_format .= ( isset( $symbols_matching[ $char ] ) && strpos( $jqueryui_format, $symbols_matching[ $char ] ) !== false ) ? $symbols_matching[ $char ] : $char;

    … you are using isset( $symbols_matching[ $char ] ) to check if an array element exists but this is not sufficient because some of the array elements are empty strings. So you need to use this instead isset( $symbols_matching[ $char ] ) && $symbols_matching[ $char ]

    The line should then read as follows …

    $jqueryui_format .= ( isset( $symbols_matching[ $char ] ) && $symbols_matching[ $char ] && strpos( $jqueryui_format, $symbols_matching[ $char ] ) !== false ) ? $symbols_matching[ $char ] : $char;

    … and the warning will not be shown.

    Oliver

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘E_WARNING: strpos(): Empty needle’ is closed to new replies.