<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Backward Incompatible Changes</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="migration53.changes.html">What has changed in PHP 5.3.x</a></div> <div class="next" style="text-align: right; float: right;"><a href="migration53.new-features.html">New features</a></div> <div class="up"><a href="migration53.html">Migrating from PHP 5.2.x to PHP 5.3.x</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="migration53.incompatible" class="section"> <h2 class="title">Backward Incompatible Changes</h2> <p class="simpara"> Although most existing PHP 5 code should work without changes, please take note of some backward incompatible changes: </p> <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> The newer internal parameter parsing API has been applied across all the extensions bundled with PHP 5.3.x. This parameter parsing API causes functions to return <strong><code>NULL</code></strong> when passed incompatible parameters. There are some exceptions to this rule, such as the <span class="function"><a href="function.get-class.html" class="function">get_class()</a></span> function, which will continue to return <strong><code>FALSE</code></strong> on error. </span> </li> <li class="listitem"> <span class="simpara"> <span class="function"><a href="function.clearstatcache.html" class="function">clearstatcache()</a></span> no longer clears the realpath cache by default. </span> </li> <li class="listitem"> <span class="simpara"> <span class="function"><a href="function.realpath.html" class="function">realpath()</a></span> is now fully platform-independent. Consequence of this is that invalid relative paths such as <em>__FILE__ . "/../x"</em> do not work anymore. </span> </li> <li class="listitem"> <span class="simpara"> The <span class="function"><a href="function.call-user-func.html" class="function">call_user_func()</a></span> family of functions now propagate <em>$this</em> even if the callee is a parent class. </span> </li> <li class="listitem"> <span class="simpara"> The array functions <span class="function"><a href="function.natsort.html" class="function">natsort()</a></span>, <span class="function"><a href="function.natcasesort.html" class="function">natcasesort()</a></span>, <span class="function"><a href="function.usort.html" class="function">usort()</a></span>, <span class="function"><a href="function.uasort.html" class="function">uasort()</a></span>, <span class="function"><a href="function.uksort.html" class="function">uksort()</a></span>, <span class="function"><a href="function.array-flip.html" class="function">array_flip()</a></span>, and <span class="function"><a href="function.array-unique.html" class="function">array_unique()</a></span> no longer accept objects passed as arguments. To apply these functions to an object, cast the object to an array first. </span> </li> <li class="listitem"> <span class="simpara"> The behaviour of functions with by-reference parameters called by value has changed. Where previously the function would accept the by-value argument, a fatal error is now emitted. Any previous code passing constants or literals to functions expecting references, will need altering to assign the value to a variable before calling the function. </span> </li> <li class="listitem"> <span class="simpara"> The new mysqlnd library necessitates the use of MySQL 4.1's newer 41-byte password format. Continued use of the old 16-byte passwords will cause <span class="function"><a href="function.mysql-connect.html" class="function">mysql_connect()</a></span> and similar functions to emit the error, <em>"mysqlnd cannot connect to MySQL 4.1+ using old authentication."</em> </span> </li> <li class="listitem"> <span class="simpara"> The new mysqlnd library does not read mysql configuration files (my.cnf/my.ini), as the older libmysqlclient library does. If your code relies on settings in the configuration file, you can load it explicitly with the <span class="function"><a href="mysqli.options.html" class="function">mysqli_options()</a></span> function. Note that this means the PDO specific constants <strong><code>PDO::MYSQL_ATTR_READ_DEFAULT_FILE</code></strong> and <strong><code>PDO::MYSQL_ATTR_READ_DEFAULT_GROUP</code></strong> are not defined if MySQL support in PDO is compiled with mysqlnd. </span> </li> <li class="listitem"> <span class="simpara"> The trailing / has been removed from the <a href="class.splfileinfo.html" class="classname">SplFileInfo</a> class and other related directory classes. </span> </li> <li class="listitem"> <span class="simpara"> The <a href="language.oop5.magic.html#object.tostring" class="link">__toString()</a> magic method can no longer accept arguments. </span> </li> <li class="listitem"> <span class="simpara"> The magic methods <a href="language.oop5.overloading.html#object.get" class="link">__get()</a>, <a href="language.oop5.overloading.html#object.set" class="link">__set()</a>, <a href="language.oop5.overloading.html#object.isset" class="link">__isset()</a>, <a href="language.oop5.overloading.html#object.unset" class="link">__unset()</a>, and <a href="language.oop5.overloading.html#object.call" class="link">__call()</a> must always be public and can no longer be static. Method signatures are now enforced. </span> </li> <li class="listitem"> <span class="simpara"> The <a href="language.oop5.overloading.html#object.call" class="link">__call()</a> magic method is now invoked on access to private and protected methods. </span> </li> <li class="listitem"> <span class="simpara"> <span class="function"><a href="function.func-get-arg.html" class="function">func_get_arg()</a></span>, <span class="function"><a href="function.func-get-args.html" class="function">func_get_args()</a></span> and <span class="function"><a href="function.func-num-args.html" class="function">func_num_args()</a></span> can no longer be called from the outermost scope of a file that has been included by calling <span class="function"><a href="function.include.html" class="function">include</a></span> or <span class="function"><a href="function.require.html" class="function">require</a></span> from within a function in the calling file. </span> </li> <li class="listitem"> <span class="simpara"> An emulation layer for the MHASH extension to wrap around the Hash extension have been added. However not all the algorithms are covered, notable the s2k hashing algorithm. This means that s2k hashing is no longer available as of PHP 5.3.0. </span> </li> </ul> <p class="simpara"> The following keywords are now reserved and may not be used in function, class, etc. names. </p> <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> <a href="control-structures.goto.html" class="link">goto</a> </span> </li> <li class="listitem"> <span class="simpara"> <a href="language.namespaces.html" class="link">namespace</a> </span> </li> </ul> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="migration53.changes.html">What has changed in PHP 5.3.x</a></div> <div class="next" style="text-align: right; float: right;"><a href="migration53.new-features.html">New features</a></div> <div class="up"><a href="migration53.html">Migrating from PHP 5.2.x to PHP 5.3.x</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>