• Hello,

    we faced a problem with the plugin cache files.

    CRITICAL syntax error, unexpected ‘”‘ in /var/www/html/wp-content/plugins/bread-finance/framework/data/instance-meta.php on line 5

    I sadly wasn’t able to see what exactly the file contained, but I would guess a crashed process while writing.

    The problem is, if the file is corrupted, it will crash the whole site.
    To prevent this from happening, we added a try-catch block in bread-finance/framework/classes/Plugin.php

    Our functions looks now like this:

    public function getData( $key, $subdir=NULL )
    {
    	if ( file_exists( $this->getPath() . '/data/' . $key . '.php' ) )
    	{
    		try {
    			$data = include $this->getPath().'/data/'.$key.'.php';
    		} catch(\Throwable $ex) {
    			unlink($this->getPath() . '/data/' . $key . '.php');
    			return NULL;
    		}
    		if ( $data )
    		{
    			return json_decode( $data, TRUE );
    		}
    	}
    	
    	return NULL;
    }

    Can you please validate our fix is correct or is there another way to prevent this issue?

    Best regards
    Andi

  • The topic ‘instance-meta.php currupted and crashed our site’ is closed to new replies.