Fix deprecation warning in PHP 8.1+
circlecube opened this issue · 1 comments
circlecube commented
PHP Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /wp-content/plugins/bluehost-wordpress-plugin/vendor/newfold-labs/wp-module-onboarding/includes/RestApi/RestApiFilter.php on line 134
The code in question looks to be:
public static function is_request_from_onboarding_flow( \WP_REST_Request $request ) {
return false !== stripos( $request->get_header( 'referer' ), 'page=nfd-onboarding' );
}
which could change to something like:
public static function is_request_from_onboarding_flow( \WP_REST_Request $request ) {
if ( !$request->get_header('referer') ) {
return false;
} else {
return false !== stripos( $request->get_header( 'referer' ), 'page=nfd-onboarding' );
}
}
abhijitb commented
@circlecube : I found another warning when running the flow on PHP 8.1+ .. have fixed that too in linked PR.