PHP6 Unofficial Changelog

You may also want to read the Unofficial PHP 6 Changelog.

If you want to make use of PHP 6 when it comes, you’re going to have to write your new scripts so they are compatible, and possibly change some of your existing scripts. To start making your scripts PHP 6 compatible, I’ve compiled a list of tips to follow when scripting:

  1. Don’t use register_globals. In PHP 6, support for register_globals will be no more. There will be no option to turn it on or off – it will not exist. This change should not affect you, as you shouldn’t really use register_globals anyway. If you don’t already know, register_globals puts $_REQUEST into the global scope, so you can access the variables just like any other variable. Instead, you should access inputed data like this:

    $_GET[‘input’];
    $_POST[‘input’];
    $_REQUEST[‘input’];

  1. Stop using magic_quotes. In my opinion, this tip should be applied whether you are using PHP 3, 4 or 5. Thankfully, in PHP 6, the magic_quotes feature is going to dissapear with register_globals. For those who don’t know, magic_quotes automically escapes single quotes, double quotes, backslashes, and NULL characters.
  2. Don’t Register Long Arrays. If you access user inputted data using $HTTP_POST_VARS or $HTTP_GET_VAR, you better stop now. Instead, you should use the superglobals – $_SERVER, $_COOKIE, $_GET, $_POST, $_FILES…
  3. preg instead or ereg. If you’re using ereg functions for regular expression tasks, then you should start using the preg functions instead. ereg will not be available in the PHP core as of version 6.
  4. Don’t initiate objects with the reference operator. If you’re initiating objects using the reference operator, you should stop now. It will generate an E_STRICT error.

    $a = & new object(); // Do not do
    $a = new object(); // Do this as of PHP 6

One thought on “PHP6 Unofficial Changelog

Leave a comment