Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Access to undeclared static property: Phalcon\\Di::$_default #12803

Closed
mohamedziada opened this issue Apr 20, 2017 · 21 comments
Closed
Labels
need script to reproduce Script is required to reproduce the issue

Comments

@mohamedziada
Copy link

mohamedziada commented Apr 20, 2017

It works fine with PHP 5.6 but when I upgrade to PHP7 this error happens

Uncaught Error: Access to undeclared static property:
Phalcon\Di::$_default bootstrap_web.php.

[:error] [pid 28022:tid 140093905889024] [client xxx.xxx.xxx.xxx:53064] PHP Fatal error: 
Uncaught Error: Access to undeclared static property:
 Phalcon\\Di::$_default in /path/to/website/app/bootstrap_web.php:20
Stack trace:
#0 [internal function]: Phalcon\\Di->__construct()
#1 /path/to/website/app/bootstrap_web.php(20): Phalcon\\Di\\FactoryDefault->__construct()
#2 /path/to/website/public/index.php(18): require(/path/to/website/app/b...')
#3 {main}
Next Error: Access to undeclared static property: Phalcon\\Di::$_default in /path/to/website/app/bootstrap_web.php:20
Stack trace:
#0 [internal function]: Phalcon\\Di->__construct()
#1 /path/to/website/app/bootstrap_web.php(20): Phalcon\\Di\\FactoryDefault->__construct()
#2 /path/to/website/public/index.php(18): require('/path/to/website/app/b...')
#3 {main}
  thrown in /path/to/website/app/bootstrap_web.php on line 20, referer: http://website.url

Details

  • Phalcon version: 3.1.2
  • PHP Version: PHP 7.0.15 (cli) (built: Feb 27 2017 23:58:56) (Zend Engine v3.0.0 ,with Zend OPcache v7.0.15,)
  • Operating System: CentOS Linux release 7.3.1611 (Core)
  • Installation type: Compiling from source
  • Server: Apache and Compiling from source
  • Other related info (Database, table schema): DB Mysql 5.7
@sergeyklay sergeyklay added the need script to reproduce Script is required to reproduce the issue label Apr 20, 2017
@sergeyklay
Copy link
Contributor

@mohamedziada Could you please provide script / steps to reproduce?

@grigoriy-ivanov
Copy link

Something similar in #12056

@sergeyklay
Copy link
Contributor

sergeyklay commented Apr 20, 2017

If @mohamedziada used Windows - yes

@hakimio
Copy link

hakimio commented Apr 21, 2017

Can you reproduce with OPcache disabled? Do you use ApcMetaData?
Can you reproduce running test case provided by renatomjr: #12056 (comment) ?

@hakimio
Copy link

hakimio commented Apr 21, 2017

ownCloud users are experiencing similar issue with PHP 7 on linux (openSUSE) too :
https://www.bountysource.com/issues/30829375-access-to-undeclared-static-property-oc-files-filesystem-normalizedpathcache
So, it might be possible that it's not only Windows issue.

EDIT: in case of ownCloud, the issue seems to appear when there are some aborted requests/connections. We could also try a similar test case like suggested in the ownCloud thread:
https://pastebin.com/Ywhjx5hq

@Jurigag
Copy link
Contributor

Jurigag commented Apr 21, 2017

@hakimio but this test case doesn't have phalcon calls so how it's phalcon issue?

@hakimio
Copy link

hakimio commented Apr 21, 2017

@Jurigag you put your Phalcon calls in your index.php and it tries to simulate cancelled requests.

Edit: inside your index.php, could be sth simple like the following:

$di = new Phalcon\Di();
sleep(1);

@Jurigag
Copy link
Contributor

Jurigag commented Apr 21, 2017

I just never had this problem on debian 7/ubuntu 14 and php 7/5.6, this is really weird. For sure it's somehow OS/apache related, never had this on php-fpm.

@hakimio
Copy link

hakimio commented Apr 21, 2017

This never happens on PHP 5.6. It's only PHP 7 issue. I guess, that's because they made some major changes to the way GC and static properties work in PHP 7.

It's easy to just blame the OS without investigating the issue.

@Jurigag
Copy link
Contributor

Jurigag commented Apr 21, 2017

Im not blaming the OS, im blaming apache. The similar thing that in all those issues people use mod_php - i think somehow mod_php + phalcon is problem, maybe OS related too.

The best will be if someone can do some vagrantbox/docker to reproduce issue. Maybe @sjinks could then do some digging to figure this out.

@mohamedziada
Copy link
Author

mohamedziada commented Apr 21, 2017

@sergeyklay I use CentOS 7.3.1611 with compile Apache and PHP and Phalcon as above
Btw it works fine with ubuntu with same versions

sleep(1);

is not a good solutions as i use Phalcon for speed not to sleep :)
My scripts is

public/index.php
<?php require '../app/bootstrap_web.php';

  • And files here in gist

https://gist.github.com/mohamedziada/b347247f40bd8f54e8e7717132c4965c

@hakimio
Copy link

hakimio commented Apr 21, 2017

The sleep() call was just for a simple test case. Solution is to run php-cgi with fcgi+apache or nginx,

@mohamedziada
Copy link
Author

@hakimio

sleep() ;

no effect still the same error

@hakimio
Copy link

hakimio commented Apr 22, 2017

What??? Do you actually understand what I am saying?
I don't think so...

@mohamedziada
Copy link
Author

@hakimio yes i try sleep() ; for test
i didn't use
"run php-cgi with fcgi+apache or nginx"
i can't change server settings right now

@mohamedziada
Copy link
Author

@hakimio you can explain to me, maybe i understand wrong

@hakimio
Copy link

hakimio commented Apr 22, 2017

Ok, can you provide some virtual machine or docker image which can reproduce the issue?

@mohamedziada
Copy link
Author

@hakimio this is wt i do now, Virtual Machine (vagrant) and will test, but it may takes time from me, cuz i am not in my office next a few days

@salva-flores
Copy link

I got the same issue after upgrading to PHP 7.1.1 and phalcon 3.1.2.

@Jurigag
Copy link
Contributor

Jurigag commented May 2, 2017

@salva-flores as already mentioned in many places, use php-fpm/fcgi

@sergeyklay
Copy link
Contributor

Close in favor of #12056

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need script to reproduce Script is required to reproduce the issue
Projects
None yet
Development

No branches or pull requests

6 participants