note 81932 added to migration5.incompatible
| From: | Steven at osu1 dot php dot net | Date: | Thu, 20 Mar 2008 00:07:29 +0000 |
| Subject: | note 81932 added to migration5.incompatible | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137219@lists.php.net to get a copy of this message | ||
Three more that we discovered:
== 1. No longer can re-assign $this ==
The follwoing example works under PHP4 (it outputs "OK"), but produces a fatal error under
PHP5:
<?
class a
{
var $text;
function a() { $this->text = 'OK'; }
}
class b
{
var $text = 'NOT OK';
function b() { $this = new a(); }
}
$myClass = new b();
echo $myClass->text;
?>
== 2. No comments allowed after shorthand echo block ==
The follwoing example works under PHP4, but produces a sytax error under PHP5.
<?=//comment?>
== 3. Constructors return a reference as default ==
The follwoing example works under PHP4, but produces an E_NOTICE notice under PHP5.
<?
class MyClass { function MyClass() { echo('OK'); } }
$myObj = null;
$myObj &= new MyClass();
?>
Removing the ampersand solves the problem
----
Server IP: 203.16.234.19
Probable Submitter: 128.184.132.11 (proxied: 128.184.148.54)
----
Manual Page -- http://www.php.net/manual/en/migration5.incompatible.php
Edit -- https://master.php.net/note/edit/81932
Del: integrated -- https://master.php.net/note/delete/81932/integrated
Del: useless -- https://master.php.net/note/delete/81932/useless
Del: bad code -- https://master.php.net/note/delete/81932/bad+code
Del: spam -- https://master.php.net/note/delete/81932/spam
Del: non-english -- https://master.php.net/note/delete/81932/non-english
Del: in docs -- https://master.php.net/note/delete/81932/in+docs
Del: other reasons-- https://master.php.net/note/delete/81932
Reject -- https://master.php.net/note/reject/81932
Search -- https://master.php.net/manage/user-notes.php