PHP 7.2: Top Feature Updates and Release With Built-in Libsodium

6:16 pm on Sunday 1 September 2019

PHP is the most used and favorite language in development. It always known to offer promising and effective features along with every release. And again there's a new release of PHP; PHP 7.2 that adds various features, comprising a new sodium extension making PHP the first programming language to adopt modern cryptography in its standard library.


PHP 7.2 is marked as the second feature update within PHP 7 series on 30th Nov 2017. It comes up with new several improvements and new features allowing to write better code.

Features and Improvements with few Bugs Fixed:

New sodium extension: The addition of Libsodium library in the core means developers no longer have to use PECL to access the library, or to rely on openssl. It is a cross-platform and cross-languages library for encryption, decryption, signatures, password hashing and more.

Argon2 in password hash: This enhancement includes support for Argon 2 to password functions as a secure option to Bcrypt.

Object typehint: Later PHP 5 introduce a feature to specify argument types in a function’s declaration to say what type of argument is expected to be passed. And it is called as Type Hint. And in this new release of PHP 7.2 one can utilize the object data type for type hints. In other words it allow you to declare a generic object as an argument of a function or method.

Replace numeric keys in object/array casts: This enhancement is to managing key/value pairs. PHP employ this data type for arrays and objects, and stores both internally using hash tables. But instead of this both need to follow the different curtailments on what types of keys they can hold, following the probability that if the underlying hash tables are modified directly, arrays and objects can exist with an invalid internal state. And PHP 7.2 allow the replacement of the keys of array or object hash tables as proper, replacing numeric string property names in objects to integer array keys, and vice-versa. It states that now there will be no inaccessible properties.

Counting of non-countable objects: In PHP 7.2 version non-countable objects are now better managed. In antecedent versions, if one called count() on a scalar or object that doesn't implement the Countable interface, the value 1 would be returned, hypothetically hiding an error. The new release returns a warning if count() is called with a parameter that is a scalar, null, or an object that doesn't implement Countable.

Hash Context as Object: This is also one of the major area need to be improve and being noticed. While objects are the prominent structure for wrapping internal data, the hash extension is an option. But in PHP 7.2, the opaque resource is replaced to an opaque object, or say that existing code should continue to function. 

Enhance TLS constants to sane values: This improvement has been avoided by the previous RFC for PHP 5.6 due to BC reasons. This RFCs favors better security instead of backwards compatibility with version intolerant and out of date servers.

So, are you all set to switch towards PHP 7.2? Probably, till now you might have at least made the transition to PHP 7. If you haven’t then it’s perfect time to move. And if you face any issue with upgrade then contact to the mobile app development company Gurgaon; Xeliumtech Solutions for assistance.

Leave a reply