PHP Deprecated Error
-
apply_filters( ‘woocommerce_get_price_html’, $price, $this );
The above filter is giving error while using in extension and theme. We need to switch position of price and product variable in core. Below is the newrelic finding:
The stack trace indicates that there is a deprecation warning in a PHP application. The warning message states that an optional parameter?$price
?is declared before a required parameter?$product
, which is not allowed in PHP. This can cause issues because PHP requires that all optional parameters come after any required parameters in a function’s signature.
The stack trace indicates that there is a deprecation warning in a PHP application. The warning message states that an optional parameter?$price
?is declared before a required parameter?$product
, which is not allowed in PHP. This can cause issues because PHP requires that all optional parameters come after any required parameters in a function’s signature.Root Cause: The root cause of this issue is a PHP function definition that incorrectly places an optional parameter before a required parameter. This is against PHP’s function declaration rules and has been deprecated.
Potential Solutions: To resolve this issue, you should modify the function definition so that all required parameters come before any optional parameters. Specifically, you should check the function that includes the
$price
and$product
parameters and rearrange them accordingly.The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.