Support » Plugin: WP-FFPC » Error on PHP 8.0

  • WP-FFPC 1.11.2 does not work with PHP 8.0.

    How to fix as follow:

    wp-ffpc-class.php
    1016-1018 lines

    [Before fixed]

    
    	public function plugin_options_migrate( &$options ) {
    
    		if ( version_compare ( $options['version'], $this->plugin_version, '<' )  ) {
    

    [After fixed]

    
    	public function plugin_options_migrate( &$options ) {
    		if($options === false) $options = array('version' => '0.0');
    		if ( version_compare ( $options['version'], $this->plugin_version, '<' )  ) {
    

    This is caused by the

    wp-ffpc-abstract.php
    From line 514
    public static function _get_option ( $optionID, $network = false ) {

    In _get_options( $optionID, $network = false ), the return value $options has several patterns such as false (bool value), array, etc. When installing for the first time, the WP-FFPC setting does not exist in the database used by WordPress, so the value of $options becomes false (bool value).

    Then the following $options[‘version’] (public function plugin_options_migrate in wp-ffpc-class.php)
    ) will not exist ($options = false), and the first argument of version_compare will be false. However, since version_compare expects a string as an argument, a type mismatch will occur, and as of PHP 8.0, it is an error to do so.

    Please fix the issue.

    The page I need help with: [log in to see the link]

  • You must be logged in to reply to this topic.