PHP Digest # 202 (April 1 - 30, 2021)



The new type never



will be in PHP 8.1, discussing partial functions, and other suggestions and news from PHP Internals. PHP is available on Google Cloud Functions, about hacking git.php.net, Laravel Octane, PhpStorm 2021.1 and other releases, a portion of tools, videos, podcasts, articles.



Enjoy reading!









news



  • About the git.php.net hack Into the

    PHP source, the attackers pushed two commits on behalf of Rasmus Lerdorf and Nikita Popov. The problem was quickly discovered and resolved. The malicious code did not get to the users.



    As it turned out, the git.php.net server allowed HTTPS commits and used digest authentication, which takes the md5 hash as a secret. The hash database of all contributors was obtained by the cybercriminals from the master.php.net server, which, most likely, was hacked initially.



    As a result, now all development is completely transferred to GitHub, which makes life easier for language developers.
  • PHP 7.3.28 , PHP 8.0.5 - First releases after freeze.



  • PHP is available on Google Cloud Functions The

    serverless platform from Google Cloud now supports PHP natively. Using GoogleCloudPlatform / functions-framework-php / you can run functions at runtime based on PHP 7.4.



    For a few details, see the discussion on GitHub in the Symfony repository . With Symfony 5.3, everything will work thanks to the Runtime component, just install php-runtime / google-cloud .



  • Composer Command Injection Vulnerability The

    vulnerability in Composer affects only systems with Mercurial installed. Nevertheless, you should immediately update to versions 2.0.13 and 1.10.22, in which it is fixed. Vulnerability technical analysis .



  • Upcoming events:



    phpcommunity.ru.



PHP Internals



  • check [RFC] never type

    PHP 8.1 : never



    .



    , never



    , , die()



    , exit()



    . .



    function redirect(string $uri): never {
        header('Location: ' . $uri);
        exit();
    }
    
    function redirectToLoginPage(): never {
        redirect('/login');
    }
          
          





    , php.watch, audio PHP Internals News .



  • check [RFC] Deprecate implicit non-integer-compatible float to int conversions

    PHP 8.1 float



    int



    , , E_DEPRECATED



    . PHP 9.0 TypeError



    .



    function acceptInt(int $i) {
            var_dump($i);
    }
    acceptInt(3.1415);
    
    > int(3) // Deprecation notice  
          
          





    audio PHP Internals News.



  • check [RFC] Phasing out Serializable

    PHP 8.1 Serializable



    . Deprecation notice , , , __serialize()



    __unserialize()



    .



  • - PHP 8.1

    : core- Joe Watkins ( pthreads, parallel pcov), Patrick Allaert (blackfire.io) Ben Ramsey ( ramsey/uuid).



    , s_panteleev, BeerPHP . , - PHP 8.2!








    PHP 8.1:
  • [RFC] Partial Function Application

    ( ) โ€” ( ) , .



    , :

    function whole($one, $two) {
        /* ... */
    }
          
          





    :

    $partial = whole(?, 2);
          
          





    , :

    function($one) {
        /* ... */
    }
          
          





    ?



    -, , Callable



    . , :

    array_map(Something::toString(?), [1, 2, 3]);
    array_map(strval(?), [1, 2, 3]);
    
    // 
    array_map([Something::class, 'toString'], [1, 2, 3])
    array_map('strval', [1, 2, 3]);
          
          





    -, , pipe- |>



    :

    $result = "Hello World"
        |> htmlentities(?)
        |> explode(?);
          
          





    3v4l.org.



    Larry Garfield, Joe Watkins, Levi Morrison Paul Crovella RFC .



  • [RFC] Sealed Classes

    RFC sealed , .



    sealed- .



    :

    sealed class Shape permits Circle, Square, Rectangle {}
    
    final class Circle extends Shape {} // ok
    final class Square extends Shape {} // ok
    final class Rectangle extends Shape {} // ok
    
    final class Triangle extends Shape {} // Fatal error: Class Triangle cannot extend sealed class Shape.
          
          





    Java.



  • [RFC] Autoload Classmap โ€” , ( => ) . , RFC.
  • [PR] Add support for final constants โ€” final



    , .






Symfony





Laravel





Async PHP





phpstorm PhpStorm













/






Due to health problems, streams are still paused.




If you notice an error or inaccuracy, please let us know in a personal habr or telegram .

Subscribe to the PHP Digest Telegram channel .



Send link

Search links for all digests

โ† Previous issue: PHP-Digest # 201








All Articles