As we all know, most web developers love and hate PHP with a passion. I’m one of those developers that absolutely love it. I know PHP like the back of my hand. Now, since 7.2 has been released, my love is growing even more! Let’s talk about the awesomeness that the newest version brings to us.
Security is the Most Important Thing Here
The 7.2 Release offers some highly needed improvements to security.
- The Libsodium cryptography library, for authenticated encryption and high-speed elliptic cryptography, is now a core extension. I’ve been waiting for this to happen for a while now.
- The Argon2 algorithm for hashing passwords addresses my personal downsides of the current algorithms, in that they were designed for the highest memory filling rate.
- Bye bye Mcrypt. The Mcrypt cryptography library extension has been officially removed. PHP’s developers have said that Mcrypt greatly inhibited the growth of the PHP language and served as “abandonware.”
- SSL/TLS (Secure Sockets Layer/Transport Layer Security) constants have been improved.
Improved Programming Language Features
There are other updates to help fix some people’s complaints about the language. So, here we go.
- A new warning has been added when calling the
count ()function with a parameter that is a scalar, a parameter that is null, or an object that does not implement the Countable interface.
- Object typehints fix a situation in which a developer can’t declare a function that needs to be passed an object as a parameter or declare that a function should return an object. The fix uses
objectas a parameter type and as a return type.
- HashContext as Object migrates the hash extension to use an object extension for hash contexts instead of using resources.
- Conversion of numeric keys in object/array casts addresses an issue with the Zend Engine, which powers PHP 7. The engine has cases in which array hash tables can contain numeric strings, while object hash tables can have integer keys. In such cases, PHP code can’t find the keys. With the fix in PHP 7.2, keys of arrays or object hash tables are converted as appropriate, so numeric string property names in objects become integer array keys and vice versa, solving the issue of inaccessible properties.
|Published on Web Code Geeks with permission by Traven West, partner at our WCG program. See the original article here: What’s New in PHP 7.2: Literally Better Everything|
Opinions expressed by Web Code Geeks contributors are their own.