Why do neither netbeans nor PHP report an error from this code:
public function __construct ()
{
global $blog;
$this->_blog_id = $blog->blog_id;
$this->_post_amount = $blog->
$this->_limit_per_page = $blog->config_get('posts_limit_per_page');
$this->_short_sign_limit = $blog->config_get('posts_short_sign_limit');
}
I had a phone call and forgot about that unfinished 3rd line, saved my work and website silently died on it.
can also be written as
which makes no sense but is perfectly valid.
However, in your case it breaks your script because using
$instance->$other_instancewithout a__toStringmethod results in this error:Object of class Test could not be converted to string. You IDE does not check for this since since it’s really an edge case and as soon as it’s not$this->$thisbut e.g.$this->$thatwith$thatbeing e.g. the return value of another function it would be near impossible to know what$thatcan be.Here’s some example code that proves how
$this->$thiscan actually work fine:The
$this->$thisstatement will result in__toStringbeing used for the second$thisand thus it will be equivalent to$this->xyzso the whole line will end up asecho $this->xyz->foo;which is valid.