PHP 6 Compatibility

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:
  2.   $_GET['input'];
      $_POST['input'];
      $_REQUEST['input'];

  3. 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 disappear with register_globals. For those who don't know, magic_quotes automatically escapes single quotes, double quotes, backslashes, and NULL characters.
  4. The "safe_mode" also going to be remove and they will focus on "open_basedir".
  5. 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…
  6. 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.
  7. 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.
  8.   $a = & new object(); // Do not do
      $a = new object(); // Do this as of PHP 6

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <b> <i> <p> <br> <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.