Fatal Parse error syntax error when trying to activate BPS

Home Forums BulletProof Security Free Fatal Parse error syntax error when trying to activate BPS

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #41408
    Kevin Luck
    Participant

    Hi,

    When I try to activate BPS on the wpadmin/plugins page I get the following message…

    Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/xxxxxxx/public_html/xxxxxxxx.com/wp-content/plugins/bulletproof-security/includes/mscan-ajax-functions.php on line 118

    Any help would be appreciated as I have little experience with BPS.

    Kind regards, Kevin

    #41409
    AITpro Admin
    Keymaster

    Someone else contacted me about this Parse error.  What is odd is that there is a new condition in the mscan-ajax-functions.php file on line 118 that does not seem to work in some cases.  The other person who reported this same error was running PHP 5.6.40.  So the version compare condition (if the PHP version is 9.0.0 or greater) should have loaded the code for PHP versions below 9.0.0.  The php version_compare() function has been around since PHP 4.0. What version of PHP are you running?  You can get your current PHP version from the Site Health Status plugin > /wp-admin/site-health.php under the Server tab.

    if ( version_compare( PHP_VERSION, '9.0.0', '>=' ) ) {
    
    	// Note: On Windows XAMPP ONLY backslashes \ are used in getSubPathName paths. On Linux ONLY forward slashes / are used in paths.
    	class BPSMScanRecursiveFilterIterator extends RecursiveFilterIterator {
    	
    		public function accept(): bool {
    			$MScan_options = get_option('bulletproof_security_options_MScan');
    			$excluded_dirs = array();
    			$excluded_dirs_gwiod = array();
    			$wp_abspath_forward_slashes = str_replace( '\\', '/', ABSPATH );
    			$wp_install_folder = str_replace( array( get_home_path(), '/', ), "", $wp_abspath_forward_slashes );
    			
    			foreach ( $MScan_options['bps_mscan_dirs'] as $key => $value ) {
    				if ( $value == '' ) {
    					$excluded_dirs[] = $key;
    					$excluded_dirs_gwiod[] = $wp_install_folder . DIRECTORY_SEPARATOR . $key;
    				}
    			}
    	
    			$dir_filter_array_merge = array_unique(array_merge($excluded_dirs, $excluded_dirs_gwiod));
    			
    			return (bool) !in_array( $this->getSubPathName(), $dir_filter_array_merge, true );
    		}
    	}
    
    } else {
    	
    	class BPSMScanRecursiveFilterIterator extends RecursiveFilterIterator {
    	
    		#[\ReturnTypeWillChange]
    		public function accept() {
    			$MScan_options = get_option('bulletproof_security_options_MScan');
    			$excluded_dirs = array();
    			$excluded_dirs_gwiod = array();
    			$wp_abspath_forward_slashes = str_replace( '\\', '/', ABSPATH );
    			$wp_install_folder = str_replace( array( get_home_path(), '/', ), "", $wp_abspath_forward_slashes );
    			
    			foreach ( $MScan_options['bps_mscan_dirs'] as $key => $value ) {
    				if ( $value == '' ) {
    					$excluded_dirs[] = $key;
    					$excluded_dirs_gwiod[] = $wp_install_folder . DIRECTORY_SEPARATOR . $key;
    				}
    			}
    	
    			$dir_filter_array_merge = array_unique(array_merge($excluded_dirs, $excluded_dirs_gwiod));
    			
    			return !in_array( $this->getSubPathName(), $dir_filter_array_merge, true );
    		}
    	}	
    }
    #41412
    AITpro Admin
    Keymaster

    So far 3 people have reported this issue out of 19,000 people who have upgraded to BPS 5.7.  A 3rd person has contacted me today with this same problem.  So at this point I am gathering information to figure out why this problem is occurring.

    Which web host do you have?
    I would like to login to your website to gather information on why this problem is occurring for some people.  If that is ok with you then please send a WordPress Administrator login to: info at ait-pro dot com.

    Info gathered so far:
    2 people are running PHP 5.6.40
    1 person is using Tsohost hosting.

    #41420
    Kevin Luck
    Participant

    Hosted at webhostingbuzz.com

    WordPress version 5.8.3
    Current theme: Unsub (version 1)
    Current plugin: BulletProof Security (version 5.7)
    PHP version 5.6.40

    #41421
    AITpro Admin
    Keymaster

    After logging into your site, I see that you upgraded to PHP 7.4.27.  The PHP error is no longer occurring and BPS is working correctly.  I did not find any other website or server issues.   So it looks like the PHP 5.6.40 build/installation was either bad or there was a bug in PHP 5.6.40 that caused that php error.  Years ago I ran into this similar type of issue where a bad PHP build/compile was circulating around many different web hosts and it may have even been a PHP 5.6.40 build/compile.

    PHP 7 is 100% faster than PHP 5.6 – twice as fast and much more secure.
    PHP 8 is 18.4% faster than PHP 7.4.
    PHP 8.1 is 3% faster than PHP 8.
    PHP 8.1 is 33% faster than PHP 7.1.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.