Bug in the in the delete_associated_files function
-
The wpcf7-redirect plugin (in the delete_associated_files function) retrieves the path to the file to delete from the post’s metadata (probably something like _uploaded_file_path or similar). If the CF7 form has an upload field that allows multiple files, that metadata is saved as an array of paths instead of a single string. The wpcf7-redirect code, however, doesn’t handle this case and passes the array directly to file_exists(), which crashes because it expects only a string.
StackTrace:
[24-Jul-2026 07:19:39 UTC] PHP Fatal error: Uncaught TypeError: file_exists(): Argument #1 ($filename) must be of type string, array given in /home/se5ijlj/public_html/wp-admin/includes/class-wp-filesystem-direct.php:438
Stack trace: 0 /home/se5ijlj/public_html/wp-admin/includes/class-wp-filesystem-direct.php(438): file_exists() 1 /home/se5ijlj/public_html/wp-content/plugins/wpcf7-redirect/classes/class-wpcf7r-save-files.php(98): WP_Filesystem_Direct->exists() 2 /home/se5ijlj/public_html/wp-includes/class-wp-hook.php(341): WPCF7R_Save_File->delete_associated_files() 3 /home/se5ijlj/public_html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters() 4 /home/se5ijlj/public_html/wp-includes/plugin.php(522): WP_Hook->do_action() 5 /home/se5ijlj/public_html/wp-includes/post.php(3825): do_action()
You must be logged in to reply to this topic.