Transition to PHP 5.3

Original author: Cal Evans
  • Transfer
Some of those who develop applications in PHP have already downloaded and started testing new features of the largest change in the language over the past 7 years, but most developers are not interested in new features that can be applied in future developments, but changes that will affect the work already written applications.

Updated:
  • At the end of the article there is also some information on how to celebrate this glorious event in Munich.
The good news is that if you wrote the code in accordance with current trends, then your application will be affected by very few changes. Those whose code is focused on earlier versions of the language will have fun times. The article provides a list of the main points that should be paid to developers porting applications with PHP 5.2.

The above list of innovations is not final, but on the Internet in general and in changelog in particular, you can find comprehensive information on new features and changes.

Array Functions


Prior to version 5.3, many of the functions of working with arrays as arguments could accept both an array and an object and as a result give the desired result. In 5.3, many of them now only accept arrays. If you want to access the properties of an object using any of the functions presented below, you will need to first convert the object to an array.

Magic Method Changes


Prior to 5.3, these methods could be declared not only as public, but also as private, protected static, etc. Starting from 5.3, the methods indicated below cannot be static and must be public:
  • __get ()
  • __set ()
  • __isset ()
  • __unset ()
  • __call ()

Ministry of Health warns


PHP appeared a list of functions that were marked for deletion. Most of them are not for general use, but nevertheless you should check the code for the fact of their absence. These functions are:
In addition, a number of directives in PHP.INI suffered the same fate, they will now throw E_DEPRECATED warnings when activated:
  • define_syslog_variables
  • register_globals
  • register_long_arrays
  • safe_mode
  • magic_quotes_gpc
  • magic_quotes_runtime
  • magic_quotes_sybase
In version 5.0, the is_a () method was marked as not recommended in favor of instanceof, but despite this it was not removed from the language, plus it stopped throwing E_DEPRECATED.

Table ordered


The following 2 words are now reserved:
Given the nature of these two keywords, it is very unlikely that they are in your code, however, it would be nice to scan the code for their presence. If they exist, the parser will be a gurazzo, since it poorly understands PHP © . In general, they cannot be used as function names, class names, etc.

On this, look for all the more detailed information in the transition manual on 5.3 and in the comments on the news about the release, just as if someone had already spotted the new version - Be sure to leave a comment through the form below.

Progg it

PHP 5.3 BBQ Release Party München


For Slavic brothers living in Munich (Germany), or nearby: PHP 5.3 BBQ Release Party München July 17, 2009. Germ. English

image

PHP 5.3 BBQ Sponsors:Supported by:PS
Continuing the topic about GOTO, one of the comments on the original article:
  1. goto future;
  2. echo ‘PHP 5.2.x’;
  3.  
  4. future:
  5. echo ‘PHP 5.3.x’;
The sponsor of the positive is good old Russian folklore and a good ska decel .

Also popular now: