PHP 7.2 With Built-in Libsodium
PHP 7.2 With Built-in Libsodium
Written by Kay Ewbank   
Wednesday, 06 December 2017

There's a new release of  PHP that adds several features, including a new sodium extension making PHP the first programming language to adopt modern cryptography in its standard library.

phplogo

The inclusion of the Libsodium library in the core means developers no longer have to use PECL to access the library, or to rely on openssl. Libsodium is a cross-platform and cross-languages library for encryption, decryption, signatures, and password hashing. Another security improvement adds support for Argon 2 to password functions as a secure alternative to Bcrypt.

The new version of PHP, 7.2.0 has other improvements, starting with object typehints.PHP 5 added the ability to specify argument types in a function’s declaration to say what type of argument is expected to be passed. These are known as type hints. PHP 7.2 has extended this to let you use the object data type for type hints, meaning you can declare a generic object as an argument of a function or method.

A second improvement is to the handling of key/value pairs. PHP uses this data type for arrays and objects, and stores both internally using hash tables. However, the two have different restrictions on what kinds of keys they can have, leading to the possibility that if the underlying hash tables are modified directly, arrays and objects can exist with an invalid internal state. The new version converts the keys of array or object hash tables as appropriate, converting numeric string property names in objects to integer array keys, and vice-versa. This will mean there will be no inaccessible properties.

Non-countable objects are now better handled. In previous versions, if you called count() on a scalar or object that doesn't implement the Countable interface, the value 1 would be returned, potentially 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 Content is another area to have received attention. While objects are the preferred structure for wrapping internal data, the hash extension is an alternative. In this version, the opaque resource is converted to an opaque object, meaning that existing code should continue to function.

 

 phplogo

More Information

PHP Website

Related Articles

What PHP Does

PHP Variables and Expressions for Complete Beginners

Object-oriented HTML Generation In PHP

Peachpie Open Source PHP to .NET Compiler

PHP 5.6 Released

PHP Gets A Formal Specification 

The Next Version Of PHP And The Status Of PHPng

PHP Next Generation Project Announced       

The Reason For The Weird PHP Function Names       

Zend Optimizer+ For PHP?

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, FacebookGoogle+ or Linkedin.

 

Banner


Gordon Bell Prize For Earth Shattering Research
22/11/2017

For the second year in a row a Chinese team has been awarded the ACM Gordon Bell Prize, presented annually to recognize outstanding achievement in high-performance computing. This year the focus  [ ... ]



Countdown to Xmas with Santa Tracker
03/12/2017

Santa Trackers, from Norad and Google have become part of the Christmas tradition and both of them have now started their countdown to Christmas Eve when Santa takes off from the North Pole to deliver [ ... ]


More News

 

 
 

 

blog comments powered by Disqus

Last Updated ( Wednesday, 06 December 2017 )
 
 

   
Banner
RSS feed of news items only
I Programmer News
Copyright © 2017 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.