Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whip_MessageDismisser::verifyNonce(): bug fix #144

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Sep 26, 2023

The method is documented as returning a boolean value, but the wp_verify_nonce() function returns int|false.

Fixed now.

Ref: https://developer.wordpress.org/reference/functions/wp_verify_nonce/

Note: as the test suite does not test with a real WP setup, this bug currently cannot easily be proven, nor safeguarded via a test.

The WHIP_WPMessageDismissListener::listen() method uses this function and does have a test, but mocks away the Whip_MessageDismisser::verifyNonce() method. The mock correctly returns true|false, but that isn't what the reality was doing.

/cc @vraja-pro

The method is documented as returning a boolean value, but the `wp_verify_nonce()` function returns `int|false`.

Fixed now.

Ref: https://developer.wordpress.org/reference/functions/wp_verify_nonce/

Note: as the test suite does not test with a real WP setup, this bug currently cannot easily be proven, nor safeguarded via a test.

The `WHIP_WPMessageDismissListener::listen()` method uses this function and does have a test, but mocks away the `Whip_MessageDismisser::verifyNonce()` method. The mock correctly returns `true|false`, but that isn't what the reality was doing.
@jrfnl jrfnl added this to the 1.x Next Release milestone Sep 26, 2023
@coveralls
Copy link

Pull Request Test Coverage Report for Build 6312539342

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 27.5%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Whip_MessageDismisser.php 0 1 0.0%
Totals Coverage Status
Change from base Build 6312330475: 0.0%
Covered Lines: 66
Relevant Lines: 240

💛 - Coveralls

@jrfnl jrfnl merged commit 4d772bf into main Sep 26, 2023
17 checks passed
@jrfnl jrfnl deleted the JRF/whip_messagedismisser-fix-type-return-value branch September 26, 2023 12:28
@enricobattocchi enricobattocchi modified the milestones: 1.x Next Release, 2.0 Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants