From cc20df6d3047ada7c5e4c3ad178f2df34cf1d14f Mon Sep 17 00:00:00 2001 From: Sorin Marta Date: Thu, 29 Oct 2026 13:43:17 +0200 Subject: [PATCH 1/2] Show step errors on GET requests instead of a fatal error Fixes Strategy11/awpcp#3210 --- includes/views/class-base-page.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/views/class-base-page.php b/includes/views/class-base-page.php index a3fc9184e..e7ce80ad4 100644 --- a/includes/views/class-base-page.php +++ b/includes/views/class-base-page.php @@ -139,7 +139,8 @@ private function handle_step_exception( $exception, $step ) { $step->get( $this ); } else { $message = __( 'Your request cannot be processed at this time. Please try again or contact the administrator about the incident.', 'another-wordpress-classifieds-plugin' ); - throw new AWPCP_Exception( esc_html( $message ), esc_html( $exception->get_errors() ) ); + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- Errors are sanitized on output by awpcp_print_error() (wp_kses_post). + throw new AWPCP_Exception( esc_html( $message ), $exception->get_errors() ); } } From bfe87612b3cda4f65e415823d951148e2e0e74d1 Mon Sep 17 00:00:00 2001 From: Sorin Marta Date: Thu, 29 Oct 2026 11:33:29 +0200 Subject: [PATCH 2/2] Replace finfo_close() and imagedestroy() with unset() Both functions have been no-ops since PHP 8.0 and are deprecated in PHP 8.5, which fails the PHPCS inspection. --- includes/functions/deprecated.php | 3 +-- includes/media/class-mime-types.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/includes/functions/deprecated.php b/includes/functions/deprecated.php index 955f4177a..3e6c3a9c3 100644 --- a/includes/functions/deprecated.php +++ b/includes/functions/deprecated.php @@ -830,8 +830,7 @@ function awpcp_resizer($filename, $dir) { break; } - imagedestroy($src); - imagedestroy($tmp); + unset( $src, $tmp ); return true; } diff --git a/includes/media/class-mime-types.php b/includes/media/class-mime-types.php index 65e5aa26c..82131fc95 100644 --- a/includes/media/class-mime-types.php +++ b/includes/media/class-mime-types.php @@ -39,7 +39,7 @@ private function get_file_mime_type_with_fileinfo( $filepath ) { $fileinfo = finfo_open( defined( 'FILEINFO_MIME_TYPE' ) ? FILEINFO_MIME_TYPE : FILEINFO_MIME ); $mime_type = finfo_file( $fileinfo, $filepath ); $mime_type_parts = explode( ';', $mime_type ); - finfo_close( $fileinfo ); + unset( $fileinfo ); return array_shift( $mime_type_parts ); }