Tutorial

What is Removed From PHP 6?

In this post I am going to show you which features are removed from major release of the PHP which is PHP 6. These features are removed based on various reasons like security, incompatibility, performance, etc..

Here is the list of those features:

1) Register Globals
2) Safe Mode
3) Magic Quotes
4) Long variables ($_HTTP_*_VARS)
5) ereg removed from core
6) Short Tags

Register Globals

Main reason to remove this is the security of the PHP. If the register global is set to On then it will set all EGPCS ( Environment, Get, Post, Cookie, Server ) variables as global variable without need of the single line of code.

So for example, if your url is like “http://domain.com/index.php?name=expert-developer”; then it will set [code]$name[/code] as global and can be accessed in whole script.

This feature is set as deprecated in PHP 5.3 and going to be removed in PHP 6.

Safe Mode

Safe mode does a user check for the files that is opened by the process. It will check the user of the file and user who runs the process. Possible probles with safe mode due to this file check are as below:

1) File Uploads
2) File Modification features like copying, moving, rename, changing ownership and changing the permission can be done with the administrative permissions only.
3) You can not use [code]exec()[/code] and [code]system()[/code] functions, if safe mode is on.

This feature is set as deprecated in PHP 5.3 and going to be removed in PHP 6.

Magic Quotes

Magic Quotes is a features which will automatically perfom an addslashes opration to the GET, POST and COOKIE values. But this is not the full proof solution to the SQL Injection.

To know more, please check my article on Magic Quotes in PHP.

Long Variables

In earlier verison of PHP POST and GET variables are accessed using the $HTTP_POST_VARS and $HTTP_GET_VARS respectively.

But after the introduction of PHP 4.1.0, these long variables are no longer used.

So, PHP 6 is going to remove the support for these Long Varibales.

ereg

ereg matches the string based on given regular expression in case sensitive manner.

[code]preg_match()[/code] is become an alternative to [code]ereg()[/code], [code]preg_match()[/code] is faster in terms of execution of the program than [code]ereg()[/code].

This function is set as deprected in PHP 5.3 and going to be removed from PHP 6.

Short Tag

Short tag is method of printing variable in short manner.

Below both codes are same if short tag is enabled.

[cc lang=”php”]


[/cc]

But it is not good to rely on this feature because configuration of the PHP can be different from one server to another. Because this can be disabled from PHP.ini.

Conclusion

What you think which feature should be removed and any other feature you wish to have in PHP 6? Yes we know that PHP people will not going consider our wishes from here. But as I say it is good to share.

Shares:
  • Michael DePetrillo
    November 22, 2011 at 1:25 am

    Are they really removing short tags? I love short tags why get rid of them they help me code templates much more quickly.

    Reply
    • Avinash
      November 22, 2011 at 12:35 pm

      Yes its going to removed from PHP 6, so its not good to rely on that..

      Reply
  • Andrew Champ
    November 22, 2011 at 10:46 am

    Litering your code w/ php seems mindless to me because of a simple xml conflict (which can be fixed by printing the xml decoration)

    I believe short-tags will still work by just turning them back on. May be set off by default.

    Reply
    • Avinash
      November 22, 2011 at 12:37 pm

      Short tags are no more supported from PHP 6, yes in current PHP version you can enable from php.ini

      Reply
  • Knut Eirik Leira Hjelle
    Knut Eirik Leira Hjelle
    November 22, 2011 at 7:32 pm

    PHP < 5.4.0 relied on short_open_tags to be enabled to access while PHP >= 5.4.0 always have this available. Source http://php.net/manual/en/ini.core.php

    Reply
    • Samuel Lindblom
      Samuel Lindblom
      May 13, 2012 at 4:36 pm

      What you are saying applies to shorthand echo, but no all short open tags, according to the manual you’re linking:

      This directive also affected the shorthand <?= before PHP 5.4.0, which is identical to <? echo. Use of this shortcut required short_open_tag to be on. Since PHP 5.4.0, <?= is always available."

      Reply
  • anon
    anon
    November 24, 2011 at 9:49 am

    php6 is dead.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *