• Resolved erseco

    (@erseco)


    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 a null 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 not null, thereby avoiding the deprecation warning.

    Thank you for your attention to this matter.

    Best regards,
    Ernesto

Viewing 1 replies (of 1 total)
  • Plugin Author vbonamy

    (@vbonamy)

    Dear Ernesto,

    Thank you for bringing this issue.

    We have reviewed your suggested modification and have integrated it into the latest release of the wp-cassify plugin.

    I am pleased to inform you that version 2.3.3 of wp-cassify, which was released today, includes your fix for the deprecated use of parse_str() with a null value. Additionally, this update addresses several other deprecation warnings to ensure compatibility with PHP 8 and future versions.

    We have also transitioned the management of wp-cassify to GitHub, making it easier for the community to contribute improvements. You can find the repository at https://github.com/WP-Cassify/wp-cassify-develop. We encourage you and others to fork the repository and submit pull requests for any enhancements or bug fixes.

    Your proactive approach and valuable input are greatly appreciated. If you have any other suggestions or contributions, please feel free to share them via GitHub.

    Best regards,
    Vincent

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.