-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
Description
I'm running into an error when marking a delivered CF7 message as spam in Flamingo.
This is the full call stack (domain replaced with placeholder the-website.com):
thrown in /srv/www/sites/the-website.com/wp-c" while reading response header from upstream, client: 2a02:21b4:1a73:9101:a15e:31b5:a6ca:add1, server: www.the-website.com, request: "GET /wp-admin/admin.php?page=flamingo_inbound&post=2206&action=spam&_wpnonce=15b26b389b HTTP/2.0", upstream: "fastcgi://unix:/var/run/php-fpm.in-seminare.sock:", host: "www.the-website.com", referrer: "https://www.the-website.com/wp-admin/admin.php?page=flamingo_inbound"
2025/12/14 15:14:13 [error] 436262#436262: *201326 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: CF7_AntiSpam\Core\CF7_Antispam_Blacklist::cf7a_ban_by_ip(): Argument #2 ($reason) must be of type array, string given, called in /srv/www/sites/the-website.com/wp-content/plugins/cf7-antispam/core/CF7_AntiSpam_Flamingo.php on line 118 and defined in /srv/www/sites/the-website.com/wp-content/plugins/cf7-antispam/core/CF7_Antispam_Blacklist.php:56
Stack trace:
#0 /srv/www/sites/the-website.com/wp-content/plugins/cf7-antispam/core/CF7_AntiSpam_Flamingo.php(118): CF7_AntiSpam\Core\CF7_Antispam_Blacklist::cf7a_ban_by_ip()
#1 /srv/www/sites/the-website.com/wp-includes/class-wp-hook.php(339): CF7_AntiSpam\Core\CF7_AntiSpam_Flamingo->cf7a_d8_flamingo_classify()
#2 /srv/www/sites/the-website.com/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
#3 /srv/www/sites/the-website.com/wp-includes/plugin.php(522): WP_Hook->do_action()
#4 /srv/www/sites/the-website.com/wp-admin/admin.php(242): do_action()
#5 {main}
thrown in /srv/www/sites/the-website.com/wp-c" while reading response header from upstream, client: 2a02:21b4:1a73:9101:a15e:31b5:a6ca:add1, server: www.the-website.com, request: "GET /wp-admin/admin.php?page=flamingo_inbound&post=2206&action=spam&_wpnonce=15b26b389b HTTP/2.0", upstream: "fastcgi://unix:/var/run/php-fpm.in-seminare.sock:", host: "www.the-website.com", referrer: "https://www.the-website.com/wp-admin/admin.php?page=flamingo_inbound"
Problem
cf7a_ban_by_ip() declares $reason as array:
| public static function cf7a_ban_by_ip( string $ip, array $reason = array(), $spam_score = 1 ): bool { |
CF7_AntiSpam_Flamingo::cf7a_d8_flamingo_classify() sends a fixed string: cf7-antispam/core/CF7_AntiSpam_Flamingo.php
Line 124 in 2c18e00
| CF7_Antispam_Blacklist::cf7a_ban_by_ip( $flamingo_post->meta['remote_ip'], 'flamingo ban' ); |
Note: Line numbers differ from call stack because I'm on released version 0.7.2.
Solution
Changing the line to
CF7_Antispam_Blacklist::cf7a_ban_by_ip( $flamingo_post->meta['remote_ip'], ['flamingo ban'] );solves the issue and makes the feature work again. I'll create a PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels