Skip to content

Get hidden and plugin field correctly#655

Open
2ndkauboy wants to merge 4 commits intov3from
fix/fixes-from-v2-comparison
Open

Get hidden and plugin field correctly#655
2ndkauboy wants to merge 4 commits intov3from
fix/fixes-from-v2-comparison

Conversation

@2ndkauboy
Copy link
Member

The new code is using a foreach to get the two fields, but requires them to be in the correct order.

This change uses a code similar to v2 which would get the parameters, independent of the order.

Fixes: #506 (review)

The new code is using a `foreach` to get the two fields, but requires them to be in the correct order.

This change uses a code similar to v2 which would get the parameters, independent of the order.

Fixes: #506 (review)
@2ndkauboy 2ndkauboy mentioned this pull request Jul 27, 2025
@stklcode stklcode added the v3 This issue is for the new version (v3) of the plugin label Jul 28, 2025
@stklcode stklcode added this to the 3.0 milestone Jul 28, 2025
@stklcode stklcode added the bug label Jul 28, 2025
We do not use this prefix and a new rule now fails because it is too
short. Remove it from the configuration.

if ( ! isset( $fields['plugin_field'] ) ) {
// Honeypot field was not present in $_POST data.
$_POST['ab_spam__invalid_request'] = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a test case for this field that now fails:

$_SERVER = [ 'SCRIPT_NAME' => '/wp-comments-post.php' ];
Honeypot::precheck();
self::assertSame( 1, $_POST[ 'ab_spam__invalid_request' ], 'request without missing fields not detected' );

Should be either adjusted or removed if obsolete.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was removed. I've also changed the field names in the tests, since they are currently not dynamic in the way proposed in the tests. The hidden field is always comment for this comment form. This is currently hardcoded in our plugin (as it was in v2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug v3 This issue is for the new version (v3) of the plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants