What's New in PHP 8.6

(php.net)

20 points | by netol 29 minutes ago

2 comments

  • beberlei 11 minutes ago
    Most excited about the ZTS overhead reduction. If you are unfamiliar PHP can run either with or without thread safety (think using pthreads in PHP requests).

    If the overhead can be further reduced (and people have ideas) then it could be that we only need ZTS mode anymore in the future and that can open up one avenue for PHP to get native async support similar to the existing parallel extension: https://github.com/krakjoe/parallel

    More "hands-on" is the stream error handling improvements. This greatly improves the old file stream APIs to now allow throwing exceptions instead of returning false on errors:

      $context = stream_context_create([
        'stream' => [
            'error_mode' => StreamErrorMode::Exception,
        ],
      ]);
    
      try {
        $config = file_get_contents('/etc/app/config.json', context: $context);
      } catch (StreamException $e) {
        // handle error
      }
  • skeledrew 2 minutes ago
    Don't forget the new vulnerabilities that AI will find :).