<?php
class x {
function __construct(){
$x=& $this;
$x = new y;
$this->bar();
}
function foo(){
$this->bar();
}
}
class y{
function bar(){
echo "bar";
}
}
$b=new x;
Fatal error: Uncaught Error: Call to undefined method x::bar() in /in/nZXSL:6
Stack trace:
#0 /in/nZXSL(17): x->__construct()
#1 {main}
thrown in /in/nZXSL on line 6
Process exited with code 255.