I updated my environment to PHP7+Phalcon3 yesterday. Unfortunately I got an annoying error in DI which I never see. The error doesn't appear every time. It appears with probability, especially when a lot of requests comes.
I spent half a day to check this error. Below is how to reproduce it: Env: Win 10 x64 + wamp server 64 (Apache 2.4.18 + Php 7.0.8 x64 ZTS) + Phalcon 3.0.0
- Use phalcon-devtool to create a new multi modules app in apache's www directory: phalcon project --name tp --type modules
- Add 1 line in apps\frontend\controllers\IndexController.php indexAction(): die("test"); Just to disable the view and speed up the test.
- Open the project in a browser. In my case it's https://localhost/tp/. There is only one word "test" in the page.
- Press F5 and hold on for a while(10~20 seconds), the page keeps refreshing and sometimes an error flashes. If you're lucky enough when you release F5 you can see the error. Otherwise you can see the error in php_error.log:
[31-Jul-2016 05:16:41 UTC] PHP Fatal error: Uncaught Error: Access to undeclared static property: Phalcon\Di::$_default in C:\wamp64\www\tp\config\services.php:20 Stack trace:
0 [internal function]: Phalcon\Di->__construct()
1 C:\wamp64\www\tp\config\services.php(20): Phalcon\Di\FactoryDefault->__construct()
2 C:\wamp64\www\tp\public\index.php(19): require('C:\wamp64\www\t...')
3 {main}
Next Error: Access to undeclared static property: Phalcon\Di::$_default in C:\wamp64\www\tp\config\services.php:20 Stack trace:
0 [internal function]: Phalcon\Di->__construct()
1 C:\wamp64\www\tp\config\services.php(20): Phalcon\Di\FactoryDefault->__construct()
2 C:\wamp64\www\tp\public\index.php(19): require('C:\wamp64\www\t...')
3 {main}
thrown in C:\wamp64\www\tp\config\services.php on line 20