Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-17496

PHP 8.4 deprecation error can break code execution

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 4.0.0-a1
    • 4.0.0-a1, 3.3.15
    • Other
    • None
    • PHP 8.4.5

      PHP 8.4 deprecates implicitly nullable types. Currently using phpBB with f.e. PHP 8.4.5 causes error log being flooded with the tens (or more) of records like

      [13-Apr-2025 16:34:19 UTC] PHP Deprecated:  phpbb\search\backend\fulltext_postgres::delete_index(): Implicitly marking parameter $post_counter as nullable is deprecated, the explicit nullable type must be used instead in G:\htdocs\40mailer\phpbb\search\backend\fulltext_postgres.php on line 929
      

      and so on.

      The problem is that PHP 8.4 emits "Implicitly marking parameter $value as nullable is deprecated, the explicit nullable type must be used instead" deprecations when PHP encounters a declaration with an implicit nullable type, not when such functions/methods are called. Thus, considering phpBB page includes hundreds of files (at least), it takes time to emit tens (hundreds?) of such a deprecation notices before the code being executed. It makes an assumption that can cause timeout errors etc.
      F.e. with XDebug enabled when it can't connect to phpBB's error handler, example:

      [13-Apr-2025 14:35:44 UTC] Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
      [13-Apr-2025 14:35:44 UTC] PHP Deprecated:  phpbb\debug\error_handler::__construct(): Implicitly marking parameter $bootstrappingLogger as nullable is deprecated, the explicit nullable type must be used instead in [ROOT]/quickinstall/boards/test4_0413/phpbb/debug/error_handler.php on line 27
      

      and then it causes the next script to get timeout:

      [13-Apr-2025 14:36:14 UTC] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in 
      [ROOT]/quickinstall/boards/test4_0413/vendor/symfony/yaml/Parser.php on line 963
      

      For the reference:
      https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
      https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated
      https://www.php.net/manual/en/migration84.deprecated.php

            Marc Marc
            rxu rxu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: