Meta value of 0 is not begin updated in PHP7.4
-
Hello,
In the plugin the following code is used in
class-rest-request.php
on line 157:switch ( $meta_value ) { case 'IMT.REMOVE': $function_delete( $content_id, $meta_key ); break; default: $function_update( $content_id, $meta_key, $meta_value); break; }
However if the meta value is
0
, this is not working well in PHP 7.4. This is because the way the Switch function works. The type check and type conversion have changed.https://www.php.net/manual/en/control-structures.switch.php#127887
I’d suggest changing it to a simple
if
-statement like this:if( $meta_value === 'IMT.REMOVE' ) { $function_delete( $content_id, $meta_key ); } else { $function_update( $content_id, $meta_key, $meta_value ); }
This way it will work for all PHP-versions.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Meta value of 0 is not begin updated in PHP7.4’ is closed to new replies.