500 errors on PHP 7.4
-
Hopefully this is helpful. My site is breaking because your plugin is not compatible with versions of PHP lower than PHP 8.
This is because of the following code:
In includes/rest-api.php:
public function create_feedback( WP_REST_Request $request ) { $content_type = $request->get_header( 'Content-Type' ); if ( ! str_starts_with( $content_type, 'multipart/form-data' ) ) { return new WP_Error( 'wpcf7_unsupported_media_type', __( "The request payload format is not supported.", 'contact-form-7' ), array( 'status' => 415 ) ); }
To make this work with PHP 7.4 I had to update as follows:
public function create_feedback( WP_REST_Request $request ) { $content_type = $request->get_header( 'Content-Type' ); //if ( ! str_starts_with( $content_type, 'multipart/form-data' ) ) { if (!substr($content_type, 0, strlen('multipart/form-data')) === 'multipart/form-data') { return new WP_Error( 'wpcf7_unsupported_media_type', __( "The request payload format is not supported.", 'contact-form-7' ), array( 'status' => 415 ) ); }
The current version of WordPress supports PHP 7.4 so you may want to update your plugin accordingly as I expect there will be lots of people experiencing this issue.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘500 errors on PHP 7.4’ is closed to new replies.