Jump to content

PHP 8.4 support


maxf5
 Share

Recommended Posts

hey community!

i am wondering if processwire is still ready for php 8.4?

getting so much deprecated warnings with 8.4.1:

Deprecated: ProcessWire\Database::getQueryLog(): Implicitly marking parameter $wire as nullable is deprecated, the explicit nullable type must be used instead in wire/core/Database.php on line 142 
Deprecated: ProcessWire\MarkupFieldtype::__construct(): Implicitly marking parameter $page as nullable is deprecated, the explicit nullable type must be used instead in wire/core/MarkupFieldtype.php on line 82 
Deprecated: ProcessWire\MarkupFieldtype::__construct(): Implicitly marking parameter $field as nullable is deprecated, the explicit nullable type must be used instead in wire/core/MarkupFieldtype.php on line 82 
Deprecated: ProcessWire\Tfa::getModule(): Implicitly marking parameter $user as nullable is deprecated, the explicit nullable type must be used instead in wire/core/Tfa.php on line 491 
Deprecated: ProcessWire\Tfa::autoEnableSupported(): Implicitly marking parameter $user as nullable is deprecated, the explicit nullable type must be used instead in wire/core/Tfa.php on line 922 
Deprecated: ProcessWire\RememberTfa::serverValue(): Implicitly marking parameter $user as nullable is deprecated, the explicit nullable type must be used instead in wire/core/Tfa.php on line 1904 
Deprecated: ProcessWire\RememberTfa::getFingerprintString(): Implicitly marking parameter $types as nullable is deprecated, the explicit nullable type must be used instead in wire/core/Tfa.php on line 1961
Deprecated: ProcessWire\ModulesConfigs::getModuleConfigInputfields(): Implicitly marking parameter $form as nullable is deprecated, the explicit nullable type must be used instead in wire/core/ModulesConfigs.php on line 561
Deprecated: ProcessWire\ModulesLoader::hasPermission(): Implicitly marking parameter $user as nullable is deprecated, the explicit nullable type must be used instead in wire/core/ModulesLoader.php on line 750
Deprecated: ProcessWire\ModulesLoader::hasPermission(): Implicitly marking parameter $page as nullable is deprecated, the explicit nullable type must be used instead in wire/core/ModulesLoader.php on line 750
Deprecated: ProcessWire\Language::__construct(): Implicitly marking parameter $tpl as nullable is deprecated, the explicit nullable type must be used instead in wire/modules/LanguageSupport/Language.php on line 31
Deprecated: ProcessWire\Languages::setDefault(): Implicitly marking parameter $language as nullable is deprecated, the explicit nullable type must be used instead in wire/modules/LanguageSupport/Languages.php on line 309
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in wire/core/WireSessionHandler.php on line 51

 

Link to comment
Share on other sites

5 hours ago, maxf5 said:

hey community!

i am wondering if processwire is still ready for php 8.4?

getting so much deprecated warnings with 8.4.1:

Deprecation warnings say, that it potentially may not be ready for 8.4.2 or 8.4.3 or any other further version. But in my understanding, it is ready for PHP 8.4.0 and 8.4.1. 🙂


If the deprecation warnings bother you, you can disable showing only those messages with a call of PHPs set_error_handler():

/** OWN ERROR HANDLER FOR DEPRECATION NOTES ************************************/

    function myLocalDevDeprecationErrorHandler($errno, $errstr, $errfile, $errline) {
        return true; // true | false  = suppress further processing
    }

    // preceed the callback function name with the PW namespace,
    // and define the error types that should passed to the function
    set_error_handler('ProcessWire\myLocalDevDeprecationErrorHandler', E_DEPRECATED);

/** OWN ERROR HANDLER FOR DEPRECATION NOTES ************************************/


I often use this directly in site/config-dev.php, when I want to collect them, but only show them collected at the end of pages in dev local.
 

/** OWN ERROR HANDLER FOR DEPRECATION NOTES ************************************/

    function myLocalDevDeprecationErrorHandler($errno, $errstr, $errfile, $errline) {
        // CHECK / CREATE COLLECTION CONTAINER
        if (!isset($GLOBALS['DEPRECATION_WARNINGS_BAG'])) {
            $GLOBALS['DEPRECATION_WARNINGS_BAG'] = [];
        }
        if (!is_array($GLOBALS['DEPRECATION_WARNINGS_BAG'])) {
            $GLOBALS['DEPRECATION_WARNINGS_BAG'] = [];
        }

        // DO NOT SHOW THIS KNOWN THIRD PARTY ONES :
        $hideThisOnes = [
            //'FileCompiler',
            'Duplicator',
            'ProcessCustomUploadNames',
        ];
        foreach($hideThisOnes as $item) {
            if (preg_match("/{$item}/", $errfile)) return true;
        }

        // ADD IT TO THE COLLECTION
        $GLOBALS['DEPRECATION_WARNINGS_BAG'][] = [$errfile, $errline, $errstr];
        return true; // true | false  = suppress further processing
    }

    // preceed the callback function name with the PW namespace,
    // and define the error types that should passed to the function
    set_error_handler('ProcessWire\myLocalDevDeprecationErrorHandler', E_DEPRECATED);

/** OWN ERROR HANDLER FOR DEPRECATION NOTES ************************************/


 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...