nginx error after update

Hi,

after updating server to php7.1 and phalcon 3.2, my app previously working well triggers an error in nginx log:

"PHP message: PHP Warning: Invalid callback PiecesController::initialize, cannot access protected method PiecesController::initialize() in /var/www/geskonimo/public/index.php on line 39"

and this error is repeating for each controller. The app work partially: I can login/logout (so some controllers seems to work), and communication to db works too...

I'm searching since two days, have reinstalled nginx/php and tried to recompile phalcon from sourceinstead of using package...no luck



64.2k

make initialize function public in PiecesController.php ?

edited 7d ago

7.1 PHP is a breaker in many things. They failed big time not following SemVer spec, so actually we can look at both 7.1 and 7.2 as PHP 8.

Like @Izopi4a says, take a look at problematic controller / method, is it really defined as protected, and you're reffering to it from elsewhere?

edited 4d ago

Adding a controller "initialize()" function on top of controller file solve the problem..Does this means that with phalcon 3.x an explicite initialize() method is now needed? Docs I've read again does not report about such a thing..

Or, maybe some changes in class or object injection/loading ? I must say that my app was not build as MVC should be: some controllers make calls to other ones (ex: when in Clients view I need to get goods bought by this client, the ajax query use a function defined in GoodsControllers...

such code was working before with 2.x