Reputation: 17495
Can anyone have any idea, what can cause Yii2 error handler to halt correctly on following line:
echo $missing;
(assuming, that $missing
is null) and display correctly "Undefined variable: missing..." notice. And in the same time "die" totally on following line:
echo $missing->noneExisting();
and display (return) completely blank page instead of correct error message?
I have a very strange troubles with Yii2 error handler ever since I started coding in Yii2. Above code is one of examples. Another one is, that redeclaring Yii
namespace in migration causes command-line console to die ugly, instead of displaying proper fatal error.
I've been told, that this problem is caused by my PHP configuration. But I found it hard to believe -- mainly because:
I haven't changed anything in my XAMPP structure, php.ini
content etc. for past many, many months, I'm actually still using old-good 1.8.1 version of XAMPP (versioned without compliance to PHP version),
all metioned problems started about month ago, when I started coding in Yii2 and happens only in Yii2-powered apps -- I can't reproduce any of above mentioned problems in any of my Yii1-powered projects.
I agree, that this must be something in my local installation of PHP, because I have tested all of these examples in freshly-new installed XAMPP 5.6.8 and in its portable version. But, since I can only reproduce this problem in Yii2-powered project and everything goes as good as it can in Yii1-powered application or under pure PHP, then there must be some sort of nasty devil inside.
Can someone help here or at least shed some light, where should I start looking for?
Upvotes: 4
Views: 518
Reputation: 566
I found out that on certain environments, when Yii2 handles a missing variable error, it shows an error at the bottom of the debugger.
Warning: var_export does not handle circular references in ~/vendor/yiisoft/yii2/helpers/BaseVarDumper.php on line 187
Maybe that error is causing your environment to die on this. However this seems to be a bug.
Also, I found a workaround using the solution found in this Github Issue. It's not pretty, but is a solution.
Edit: A patch for this issue was released. See here
Upvotes: 1