What's new in PHP 7.2
Ian Littman / @iansltx
AustinPHP June 2017
PHP 7.2alpha1 is out!
Cleanup (technically BC breaks) - CASTS
Numeric array indexes now convert to string property names when an array is cast as an object.
The reverse direction is similar; numeric string property names now map back to integer array keys.
Previously, these transformations would give you inaccessible indexes or properties.
Cleanup (technically BC breaks) - BAREWORDS
References to undefined constants (i.e. strings without quotes around them) now generate warnings instead of notices, though they still work for now.
This will turn into an Error eventually (<= PHP 8.0).
Cleanup (technically BC breaks)
- Session status now behaves more correctly, but will now error out if you provide invalid session status codes
- hash_hmac(), hash_hmac_file(), hash_pbkdf2() don't support non-cryptographic hashes anymore
- bcmod() in BCMath no longer truncates fractions
- The json_decode() option JSON_OBJECT_AS_ARRAY is used if the second parameter (assoc) is null. Previously JSON_OBJECT_AS_ARRAY was always ignored.
- Trait property initial value compatibility check no longer casts
Windows <7||2008R2 Dropped
New Features - Available now
- Now allowed in overridden methods
- Removing a parameter typehint
- Overriding an abstract method with another one
- Trailing commas in group use declarations
- Argon2i is now the default password_hash() algo
- Zip can now read/write encrypted archives
New Features - AVailable Now
- mail()/mb_send_mail() accepts an $extra_header array
- count() now warns on non-countable objects (anything other than arrays and Countable implementors)
- number_format() now never returns negative zero
- utf8_encode(), utf8_decode() are now in the standard extension (rather than in the xml extension)
- Debuggable PDO prepared statement emulation
Libsodium is now in core!
New Features! (available soon)
- Loading extensions by name (no file extension needed)
- Better time calculations around Daylight Saving Time
- Null-coalesce equals (??=) operator
- Warning on trying to access an array offset of not-an-array (and not-ArrayAccess)
- List reference assignment, e.g. list(&$var1, $var2) = ...
- "object" typehint
- More secure values for TLS/SSL-related constants
mcrypt is now in PECL!
Deprecations (gone in PHP 8.0)
- (unset) cast
- parse_str() without second argument
- each() - it's really slow and problematic
- assert() with string argument (aka eval-check-true)
- $errcontext argument of error handler
What's New in PHP 7.2 - AustinPHP Lightning Talk
By Ian Littman