Early Look at PHP 8.2 ##################### :category: PHP :tags: php 8.2 :date: 2022-06-22 02:23:00 +0300 It's a month before the feature freeze so we can predict what the release will look like. So far it seems like an underwhelming release without any killer features. It still has very nice language improvements. These are the things I would like to highlight: .. TEASER_END Main headache ============= `Deprecate dynamic properties`__ (implemented) .. __: https://wiki.php.net/rfc/deprecate_dynamic_properties No more undeclared properties on objects unless they descend from the ``stdClass`` or are marked with ``#[AllowDynamicProperties]``. In theory it's an awesome feature that will help to catch many bugs. In practice, well, it was a feature from the olden times and who knows what the depths of ``vendor`` hide? Still not as disruptive as PHP 8.1 and its strict internal functions. Example from the RFC: .. code-block:: php name = "foo"; // Oops, a typo: $user->nane = "foo"; // PHP <= 8.1: Silently creates dynamic $user->nane property. // PHP 8.2: Raises deprecation warning, still creates dynamic property. // PHP 9.0: Throws Error exception. Nice features ============= `Redacting parameters in back traces`__ (implemented). .. __: https://wiki.php.net/rfc/redact_parameters_in_back_traces No more need to regex traces to hide passwords and stuff. Example from the RFC: .. code-block:: php