Warning in WordPress Logs from wp-cassify Plugin
-
Dear wp-cassify Support Team,
We have observed that the WordPress logs are repeatedly logging a warning related to a call from the wp-cassify plugin, causing the logs to occupy several gigabytes of space. Below is the observed error message:
[27-Jun-2024 07:31:48 UTC] PHP Deprecated: parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in /wp-content/plugins/wp-cassify/classes/wp_cassify_utils.php on line 143
This error is caused because the function
parse_str()
is being called with anull
value as the first parameter, which is deprecated as of PHP 8.1.The affected line is located in
/wp-content/plugins/wp-cassify/classes/wp_cassify_utils.php
, on line 143.To resolve this issue, the function
wp_cassify_extract_get_parameter
can be modified as follows:/**
* Return value of a parameter passed in url with get method.
* @param string $url Http url from wich you extract GET parameters
* @param string $get_parameter_name GET parameter name
* @return string $get_parameter_value GET parameter value
*/
public static function wp_cassify_extract_get_parameter( $url , $get_parameter_name ) {
$get_parameter_value = null;
$query = parse_url( $url , PHP_URL_QUERY );
if (! empty( $query ) ) {
parse_str($query, $url_params);
}
if (! empty( $url_params[ $get_parameter_name ] ) ) {
$get_parameter_value = $url_params[ $get_parameter_name ];
}
return $get_parameter_value;
}This modification ensures that the
parse_str()
function is only called when the$query
is notnull
, thereby avoiding the deprecation warning.Thank you for your attention to this matter.
Best regards,
Ernesto
- You must be logged in to reply to this topic.