What You Should Know About PHP 7.2

We must thank again one of our loyal readers for helping us realize the importance of this follow-up. The truth is, key changes in such a critical technology deserve continuous coverage. Furthermore, the “update of the update” —i.e., PHP 7.2— sets new challenges and opportunities, in and beyond Moodle.

PHP 7.2 is not the significant departure from PHP 7.1 that PHP 7 was from PHP 5. But there are incompatibilities from 7.1 to 7.2, as well as deprecated features.

But if there is one point to get across, is that PHP 5 and 7.0 are a thing of the past. The only actively supported version of the last branch is PHP 5.6, which is no longer actively developed and will stop receiving any kind of update, including security, by New Year’s Eve. PHP 7.0 will receive security support until December 3rd, and PHP 7.1 will stop active support until December 1st.

In the case of Moodle, the situation is not as dire as in other PHP-based systems, but there is some cause for concern. PHP 7.2 is compatible with Moodle 3.4 and 3.5 only, which according to the official stats cover some three fifths of registered active Moodle sites.

Hinkelman’s list

Please list the major changes in PHP 7.2 that might affect Moodle.
The bottom line is that not doing the migration will make the sites more vulnerable. But the mandatory switch should have some visible benefits including speed, smoothness in 64-bit machines (the increasing majority of them), and a decrease in the fatality of running into code errors. PHP 7.2 is designed to make the code more flexible and errors more manageable and less consequential.

Regarding the new features coming in PHP 7.2 compared from PHP 5, the list is long and highly technical. But final uses should count on a more secure and reliable system, and depending on the developer and functionality, better plugin performance.

What changes are likely to affect custom plugins, such as activity modules, themes, question types and blocks?
Other than ensuring compatibility, plugins and core features do not need to make radical changes to their code. But developers are welcome to study some of the key new features and decide whether it enhances the quality and performance of their programs:

  • Convert numeric keys in object/array casts: It expands the uses and access of data in arrays.
  • Counting of non-countable objects: When a piece of data that is not “countable,” a warning will appear next to the result of using the count() function (1).
  • Object typehint: Functions can now request that variables are objects of any kind, as long as they are objects.
  • Migration Hash Context from Resource to Object: A “Hash Resource” is a type of data for certain extensions, designed for cryptography. Before PHP 7.2 it could not be used as an object, but now it can.
  • Argon2 Password Hash: Developers can now safely store passwords using this “superior” algorithm, winner of the latest Password Hashing Competition.
  • Deprecate (then Remove) Mcrypt: The decade-old Mcrypt extension to encrypt data (not just passwords, like Argon2) is out the door. It is unlikely developers today use it.
  • Make Libsodium a Core Extension: Mcrypt’s demise gives way for Libsodium, which is more robust and is actively developed.
  • Improved SSL / TLS constants: It makes it easer to add a security layer to process involving information transfer between two systems.

Another, even more delicate issue developers (and hardly anyone else) involves the compatibility of frameworks they use to streamline PHP programming. Zend, one of the most popular, became compatible with PHP 7.2 only a few months. Developers who use Zend must upgrade both PHP and Zend to ensure compatibility.

What problems did HQ have to solve to get MoodleCloud working on PHP 7? Maybe you should interview an HQ developer about this, and get their advice for institutional upgraders.
We do not have an announcement on interviews at this time. Stay tuned!

Should schools wait to upgrade to Moodle 3.5 for a year or so, because PHP 7 is such a major change?
In short, no. PHP 7 has been around for almost 2 years. In tech time, it is plenty for both plugin and Moodle HQ developers to get acquainted and make the switch. However, the ideal and actual scenario might vary. It is estimated that 57% of the internet still uses PHP 5.6 and 7.0. You can thank WordPress most of all for this.

PHP 7 might come with new things to learn, but it is designed to make PHP programming more manageable.

This article is shared by www.fortunescripts.com | A leading resource of inspired clone scripts. It offers hundreds of popular scripts that are used by thousands of small and medium enterprises.

 

share post:

Leave a Reply

Special 50% discount available for
left to avail 50% discount offer. Hurry up!