PHP7 is evolving! What’s new?

7.1 and the upcoming 7.2 release make PHP even more awesome!

Er Galvao Abbott
The White Hat ElePHPant
3 min readJul 3, 2017

--

While I’m currently writing the next part of my “A look into sessions and security” series, I couldn’t help to take some time to write on how fast PHP7 is evolving.

PHP 7.0 was, in my opinion, the most important PHP release since PHP 5.3: it brought us new operators, awesome functionalities and even the possibility to code with strict typing — at least to a point. It’s amazing to see how fast the language keeps evolving after the .0 release and how the new functionalities themselves brought a plethora of new issues. In case you don’t know this already, you can easily follow the process of each release here.

PHP 7.1 (the current stable release) already brought us a lot of interesting features and PHP 7.2 (currently in alpha and planned for release at the end of November) will get us a few more. These are the ones that are most noticeable, in my opinion:

PHP 7.1

  • Nullable Types, RFC by Levi Morrison and Dmitry Stogov:
    A much needed improvement over the typing system, this makes possible to pass a NULL value to a parameter of any type.

$bar in this case MUST receive either a string or NULL.
$baz MAY receive an int, NULL or be omitted, defaulting to NULL.

  • The end of Mcrypt, RFC by Scott Arciszewski:
    It’s a known fact that Mcrypt is considered abandonware: it was last updated ≃ 5 years ago and it has open tickets dating back to 2003. Being an extension related to security and having a much more reliable project such as openssl available made Mcrypt’s end inevitable.
  • Void Return Type, RFC by Andrea Faulds:
    Another inherent need of PHP7’s typing system: the ability to write functions/methods that doesn’t return a value.
  • Support Class Constant Visibility, RFC by Sean DuBois:
    This one will probably see a slower rate of adoption of even interest, but it’s very useful (and arguably an obvious need) in the context of OO: the ability to define class constants as public, protected or private.

PHP 7.2

  • Argon2 Password Hash, RFC by Charles R. Portwood II
    Argon2 is the newest and most talked about hashing algorithm in actuality and rightly so: it won the Password Hashing Competition, beating 23 competitors. Starting on PHP 7.2, Argon2 will be available to be used in the password_hash functions.
  • Debugging PDO Prepared Statement Emulation, RFCs by Adam Baratz
    Probably one of the most awaited features on the language, it is as clear and straightforward as it sounds: starting on PHp 7.2 we’ll finally be able to show the resulting query of a prepared statement.
  • Object typehint, RFC by Michał Brzuchalski
    A much needed addition to the typing system, the ability to declare a parameter and/or a return type as a “generic” object. Since I’m currently developing my applications relying heavily on the typing system this is, for me, the most awaited addition to it.

Conclusion

PHP7 is a thing of beauty. The amount and quality of the changes being implemented are incredible and they are lifting the language and it’s ecosystem to a whole new level. There are a lot of other RFCs that I’ve missed here and the process is entirely public so please, go check it out and keep yourself informed and current!

Long live PHP7! ❤

--

--

Er Galvao Abbott
The White Hat ElePHPant

Brazilian programmer and web app security advisor; Zend Framework Evangelist.