nlopess Mon May 24 10:27:49 2004 EDT
Modified files: /phpdoc/en/appendices migration5.xml Log: fix backward incompatible changes http://cvs.php.net/diff.php/phpdoc/en/appendices/migration5.xml?r1=1.18&r2=1.19&ty=u Index: phpdoc/en/appendices/migration5.xml diff -u phpdoc/en/appendices/migration5.xml:1.18 phpdoc/en/appendices/migration5.xml:1.19 --- phpdoc/en/appendices/migration5.xml:1.18 Mon May 24 10:07:35 2004 +++ phpdoc/en/appendices/migration5.xml Mon May 24 10:27:49 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.18 $ --> +<!-- $Revision: 1.19 $ --> <appendix id="migration5"> <title>Migrating from PHP 4 to PHP 5</title> @@ -69,6 +69,18 @@ <listitem><simpara> An object with no properties is no longer considered "empty". </simpara></listitem> + <listitem><simpara> + In some cases classes must be declared before used. It only happens only + if some of the new features of PHP 5 are used. Otherwise the behaviour is + the old. + </simpara></listitem> + <listitem><simpara> + <function>get_class</function> starting PHP 5 returns the name of the + class as it was declared which may lead to problems in older scripts + that rely on the previous behaviour (the class name was lowercased). + A possible solution is to search for <function>get_class</function> in + all your scripts and use <function>strtolower</function>. + </simpara></listitem> </itemizedlist> <para> @@ -101,7 +113,32 @@ // Will be executed } ?> +]]> + </programlisting> + </example> + </para> + <para> + <example> + <title>In some cases classes must be declared before used</title> + <programlisting role="php"> +<![CDATA[ +<?php + +//works with no errors: +$a = new a(); +class a { +} + +//throws an error: +$a = new b(); + +interface c{ +} +class b implements c { +} + +?> ]]> </programlisting> </example>