PHP 5.4 – Core changes

Along with the above mentioned additions, a variety of new functions and additional methods to existing classes have been added.
Classes now support the Class::{expr}() syntax. Now you can accomplish something like the following for static calls:

class Test
{
 public static function parseH4()
 {
 echo "H4 Parsed";
 }

 public static function parseH2()
 {
 echo "H2 Parsed";
 }

}

$t = new Test;
$method_prefix = "parse";

$t::{$method_prefix . "h4"}();
$t::{$method_prefix . "h2"}();

Although not a very creative use of the idea, the real power of the above will manifest itself when using dynamic method calls. Along with the support for expressions while calling static class methods, class member access on instantiation has also been added, as shown below.


class Test
{
 public function SayHello()
 {
 echo "Hello World!";
 }
}

(new Test)->SayHello();

Magic quotes has been completely removed. Applications dependent on this feature may need to be updated, to avoid security issues. get_magic_quotes_gpc() and get_magic_quotes_runtime() now always return FALSE. set_magic_quotes_runtime() raises an E_CORE_ERROR level error.

The following functions have been removed from PHP 5.4, so if you are developing any new applications which will probably be migrated to PHP 5.4, avoid using the following functions.

define_syslog_variables()
import_request_variables()
session_is_registered()
session_register()
session_unregister()
mysqli_bind_param()
mysqli_bind_result()
mysqli_client_encoding()
mysqli_fetch()
mysqli_param_count()
mysqli_get_metadata()
mysqli_send_long_data()
mysqli::client_encoding()
mysqli_stmt::stmt()

The register_globals and register_long_arrays php.ini directives have been removed. Safe mode also is no longer supported. Any applications that rely on safe mode for security reasons may need adjustment. This feature had already been deprecated as of PHP 5.3.0 and is now completely removed. This will now generate a fatal E_CORE_ERROR level error when enabled.

Leave a Reply

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

*