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

Error in model 'find', 'findFirst methods with latest Phalcon 2.1.x build and PHP7

  • PHP Version 7.0.4-7+deb.sury.org~trusty+2
  • phalcon
  • Version 2.1.0r
  • Powered by Zephir Version 0.9.2a-dev
  • nginx + php-fpm

simple script:


$config = array(
    "host" => "localhost",
    "dbname" => "testbase",
    "port" => 3306,
    "username" => "testbase",
    "password" => "testbase"
);
use Phalcon\Di\FactoryDefault;
$di = new FactoryDefault();
$di->set('db', function() use ($config) {
    return new \Phalcon\Db\Adapter\Pdo\Mysql([
        "host"     => $config['host'],
        "username" => $config['username'],
        "password" => $config['password'],
        "dbname"   => $config['dbname']
    ]);
});
$m = TestModel::findFirst();

I see '502 Bad Gateway' error page and nginx log '*956 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1'

edited Mar '16

What do you get with a simple echo "test";?

All tests before last line find or findFirst works normal, but only with die or exit.

I tried recompile few times and update repozitories cpahlcon and zephir, but results the same :(

Is it only my problems?



85.5k
edited Mar '16

for me, php 7 doesnt work at all, there was one "big: issue with constructors wasnt called which was fixed few days ago, however this problem is probably because of create instance params.

More info:

https://github.com/phalcon/cphalcon/pull/11578

https://github.com/phalcon/cphalcon/issues/11550

That is happening to me too! Exactly that!



145.0k
Accepted
answer

Most of problems are beacause of zephir. There are zephir repo: https://github.com/phalcon/zephir/issues There are many PHP 7 issues, and they can occur like really many times. We have to wait until zephir is updated and most of problems on phalcon will be fixed.