• Hi there,
    For some reason I cannot activate the plguin.
    When I try I get fatal error:

    Plugin could not be activated because it triggered a fatal error.

    Fatal error: Uncaught ValueError: Path cannot be empty in /var/www/__site__/wp-content/plugins/http-headers/http-headers.php:1324 Stack trace: #0 /var/www/__site__/wp-content/plugins/http-headers/http-headers.php(1324): file_put_contents() #1 /var/www/__site__/wp-content/plugins/http-headers/http-headers.php(1560): update_auth_credentials() #2 /var/www/__site__/wp-includes/class-wp-hook.php(287): http_headers_activate() #3 /var/www/__site__/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters() #4 /var/www/__site__/wp-includes/plugin.php(484): WP_Hook->do_action() #5 /var/www/__site__/wp-admin/plugins.php(193): do_action() #6 {main} thrown in /var/www/__site__/wp-content/plugins/http-headers/http-headers.php on line 1324

    Ubuntu: 16.04
    PHP: 8.0.2
    WP Version: 5.6.2

    Web server: apache + php-fpm

    I guess it has something to do with PHP 8.0. Probably this part:
    “Most of the internal functions now throw an Error exception if the validation of the parameters fails.”

Viewing 1 replies (of 1 total)
  • Thread Starter Debugger

    (@retrobeatcom)

    function update_auth_credentials() {
    	if (get_option('hh_method') == 'htaccess') {
    		$credentials = apache_auth_credentials();
    		
    		return @file_put_contents($credentials['ht_file'], $credentials['auth']);
                           ^
    	}
    	
    	return false;
    }

    in my case $credentials is false

    In PHP 8.0, the @ operator does not suppress certain types of errors that were silenced prior to PHP 8.0. This includes the following types of errors:

    E_ERROR – Fatal run-time errors.
    E_CORE_ERROR – Fatal errors occurred in PHP’s initial startup.
    E_COMPILE_ERROR – Fatal compile-time errors (from Zend engine).
    E_USER_ERROR – User-triggered errors with trigger_error() function.
    E_RECOVERABLE_ERROR – Catchable fatal error.
    E_PARSE – Compile-time parse errors.
    All of these errors, if raised, halts the rest of the application from being run. The difference in PHP 8.0 is that the error message is not silenced, which would have otherwise resulted in a silent error.

    • This reply was modified 3 years, 9 months ago by Debugger.
Viewing 1 replies (of 1 total)
  • The topic ‘Cannot activate the plugin – fatal error on php 8.0.2’ is closed to new replies.