We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Fatal error in multi modules app with PHP7+Phalcon3.0

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

  1. Use phalcon-devtool to create a new multi modules app in apache's www directory: phalcon project --name tp --type modules
  2. Add 1 line in apps\frontend\controllers\IndexController.php indexAction(): die("test"); Just to disable the view and speed up the test.
  3. Open the project in a browser. In my case it's https://localhost/tp/. There is only one word "test" in the page.
  4. 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

For me it's working on vagrant/ubuntu 14.04. I guess the problem is windows.



507

I have the exact same issue, I am using Phalcon Micro as a Restful API (Many Projects all the same issue) and is on Windows ENV for local development. I am using PHP 7.0.8.0 32BIT TS and latest Phalcon 3.

It randomly occurs, if i keep reloading the api endpoint, then somtimes the message goes away and works but usually it does not.

<b>Fatal error</b>: Uncaught Error: Access to undeclared static property: Phalcon\Di::$_default in xxxxxx\api_v2\config\services.php:15 Stack trace:

0 [internal function]: Phalcon\Di->__construct()

1 XXXXXXXXXXXX\api_v2\config\services.php(15): Phalcon\Di\FactoryDefault->__construct()

2 XXXXXXXXXXXX\api_v2\public\index.php(15): include('X:\Projects\are...')

3 {main}

Next Error: Access to undeclared static property: Phalcon\Di::$_default in xxxxxx\api_v2\config\services.php:15 Stack trace:

0 [internal function]: Phalcon\Di->__construct()

1 XXXXXXXXXXXX\api_v2\config\services.php(15): Phalcon\Di\FactoryDefault->__construct()

2 XXXXXXXXXXXX\api_v2\public\index.php(15): include('X:\Projects\are...')

3 {main}

thrown in <b>X:\Projects\area\api_v2\config\services.php</b> on line <b>15</b><br />

Have been waiting so long for Phalcon 3 and php 7, hope this will be fixed shortly, inprogress of setting up new servers for a client and woudl liek to have php 7 on it.

THanks

Same issue, since this morning after updating nginx 1.11.9 and phalcon 3.0.3

each pages may be reload 3 times before working

There is issue created on github on possible wokrarounds for windows.