• Resolved ldwd

    (@ldwd)


    Since updating from 4.23.0 to 4.24.0, hCaptcha on our custom signup form with the [hcaptcha] shortcode stopped working. During debugging I encountered this error: Uncaught Error: Call to undefined function hcaptcha_verify_post();.
    Browsing the FAQ on this plugin page I learned that apparently $result = hcaptcha_verify_post(); should now be $result = \HCaptcha\Helpers\API::verify_request(); in our custom function to verify the hCaptcha challenge. I replaced this which solved the issue, but I did not see any mention of this change in de change log or as a notice on my dashboard.

    • This topic was modified 3 weeks, 4 days ago by ldwd. Reason: Fixed typo
Viewing 1 replies (of 1 total)
  • Plugin Contributor kaggdesign

    (@kaggdesign)

    Hi @ldwd,

    Thanks for the report.

    hcaptcha_verify_post() was deprecated in 4.15.0, so this is not a recent change. By 4.24.0, it had already been deprecated for 10 plugin versions.

    For reference, this is the PHPDoc that had been present in the plugin:

    /**
     * Verify POST.
     *
     * @deprecated 4.15.0 Use \HCaptcha\Helpers\API::verify_post().
     *
     * @param string $nonce_field_name  Nonce field name.
     * @param string $nonce_action_name Nonce action name.
     *
     * @return null|string Null on success, error message on failure.
     */
    function hcaptcha_verify_post( string $nonce_field_name = HCAPTCHA_NONCE, string $nonce_action_name = HCAPTCHA_ACTION ): ?string {
        _deprecated_function( __FUNCTION__, '4.15.0', '\HCaptcha\Helpers\API::verify_post()' );
    
        return API::verify_post( $nonce_field_name, $nonce_action_name );
    }
    

    In addition, every call to this function triggered a deprecation notice via _deprecated_function(), which is logged when WP_DEBUG is enabled.

    So replacing it with the current API was the correct approach.

    As for the changelog: listing the removal of long-deprecated functions is generally not standard practice. Changelogs typically focus on user-facing changes, not internal cleanup of APIs that had already been deprecated well in advance.

    If you rely on custom integration code, it’s recommended to update deprecated calls when they are first marked as such, rather than when they are eventually removed.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.