PHP Digest # 216 (November 15 – 30, 2021)
A selection of fresh news and materials from the PHP world.
In release: PHP 8.1 released, the PHP Foundation was created to develop and support PHP, a critical vulnerability in doctrine / dbal, dynamic properties will be deprecated in PHP 8.1, Symfony 6 and Symfony 5.4 released.
Also included in this issue are helpful articles, videos, and other community news.
This digest was prepared in collaboration with Insolita… If you liked the issue, please add the post.
news
PHP 8.1 released
Key new features:
- Enums are also enumerations;
- Readonly properties;
- First-class callable – getting a reference to any function;
- New operator in initializers (and nested attributes);
- Fibers;
- final constants in classes;
- New type
never
for (un) return values; - Writing octal numbers with a 0o prefix;
- Operator
...
supports arrays with string keys;
In the release, Dmitry Stogov and other contributors have made many performance improvements.
On Symfony and Laravel, the gain will be significant (+ 23% to speed on the Symfony demo application).
On other applications, it will most likely be less noticeable. For example, on WordPress, the growth will be up to + 3.5%The release also includes many deprecations, consistency improvements and error handling.
Basic deprecations:
- Deprecated implicit conversion
float
vint
where the fractional part is lost; - Interface
Serializable
Deprecated - Limited use
$GLOBALS
; - Deprecated value passing
null
into parameters of built-in functions that are notnullable
; - Added return types for built-in classes (and a new attribute
#[ReturnTypeWillChange]
); - Continued
удаление типа resource
… The resources file_info, imap FTP Connection, LDAP, PostgreSQL will now be objects, respectively, finfo, IMAP Connection, FTP Connection, PgSql Connection, PgSql Result.
Read more-see:
Important:
PHP 7.4 active support has already ended, that is will be only security fixes throughout the year.
A PHP 7.3 support will be completely discontinued on December 6…
Update!The New Life of PHP – The PHP Foundation
JetBrains teamed up with Automattic (WordPress), Acquia (Drupal), Laravel, Private Packagist (Composer), Symfony, Zend, Craft CMS, Tideways and PrestaShop to form a non-profit organization PHP Foundation, whose mission is to ensure the long-term development of the PHP language…
One of the reasons for the creation of the organization was the change in the interests of Nikita Popov. He has been working with PHP for 10 years and for the last 3 years Nikita’s work on PHP has been paid for by JetBrains. Besides PHP, Nikita has contributed to LLVM and Rust for a long time. And now he decided to focus his professional activities on LLVM and from December 1 Nikita will move to work in another company. Nikita will still be part of the PHP community, but there will be much less contributing.
The primary task of the foundation is to employ developers on a full or part-time basis, who will deal with the core of the PHP interpreter in the repository. php / php-src…
I told in detail about the history of the foundation and the work of the fund on the stream: About PHP Foundation with Roman Pronsky…
You can read more about the foundation and the history of its influence on PHP in post by Joe Watkins (made a great contribution to the creation of the fund).
You can donate to the fund by following the link:
opencollective.com/phpfoundationWe will post updates about the work on Twitter: @ThePHPF…
Composer gets even faster
In the next release, Pool Optimizer will be enabled by default – this will noticeably speed up the update installation operations, and the more complex the set of dependencies in composer.json, the more significant the speed gain and less memory consumption.
[RFC] Deprecate dynamic properties
Despite numerous controversies, the proposal was accepted with a margin of only two votes 52:25!
This means that in PHP 8.2 dynamic (undeclared) properties will be deprecated, and in PHP 9.0 they will be completely removed. Read more in PHP Digest # 215.
In the topic, a fresh article from Larry Garfield about PHP evolution controversy…
Came out Doctrine DBAL 3.2.0
Also discovered critical SQL injection in doctrine / dbal 3.0.0 – 3.1.3you should upgrade to 3.1.4 or newer immediately.
[RFC] Readonly classes
Máté Kocsis offers readonly classes for PHP 8.2. In fact, it is just a class in which all properties are readonly and dynamic properties are prohibited. That is, it’s a little syntactic sugar for convenience.
readonly class Foo { public string $prop; }
Equivalent to:
class Foo { public readonly string $prop; public function __set($name, $value) { throw new Error('Cannot create dynamic property'); } }
Instruments
- clue / framework-x – Reactive micro-framework from the makers of ReactPHP.
- marcosh / lamphpda – A set of immutable structures for functional programming.
- web3-php / web3 – Client for working with Ethereum RPC.
- SergiX44 / Nutgram – Telegram bot framework with simple API.
- CuyZ / Valinor – Mapper data into strongly typed objects.
Symfony
Laravel
Yii
Articles
Audio Video
Community
Subscribe to the Telegram channel PHP Digest…
This digest was prepared in collaboration with Insolita… If you liked the episode, subscribe to Julia on Twitter and put a plus in the post, please.
Did you spot a mistake or typo? Notify in PM Habr or telegram…
You can send a link through the form or simply by writing to me in telegram…
Search for links in all digests
← Previous issue: PHP-Digest # 215