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

Segmentation Fault when using find() or creating instance of model #887

Closed
dfsoeten opened this issue Feb 4, 2019 · 3 comments
Closed

Comments

@dfsoeten
Copy link

dfsoeten commented Feb 4, 2019

I'm trying to setup MongoDB using this package and it's ODM. Currently everything seems to work except the instantiation of models extending the \Phalcon\Mvc\MongoCollection class.

My services.php:

use Phalcon\Db\Adapter\MongoDB\Client as MongoClient;
use Phalcon\Mvc\Collection\Manager;

//MongoDB Database
$di->set('mongo', function () {
    $mongo = new MongoClient('mongodb://' . getenv('MONGODB_HOST') . ':' . getenv('MONGODB_PORT'));

    return $mongo->selectDatabase(getenv('MONGODB_NAME'));
});

//Collection Manager
$di->set('collectionManager', function () {
    return new Manager();
});

My Pages.php model:

class Pages extends \Phalcon\Mvc\MongoCollection
{
    public function getSource(){
        return 'pages';
    }
}

When I try to do the following, my page results in a The connection was reset error and child pid <id> exit signal Segmentation fault (11) notice in the Apache logs:

$pages = new Pages();

OR

Pages::find();

However, I can do $mongo->listDatabases() and get the following result:

object(Phalcon\Db\Adapter\MongoDB\Model\DatabaseInfoLegacyIterator)#167 (1) { ["databases":"Phalcon\Db\Adapter\MongoDB\Model\DatabaseInfoLegacyIterator":private]=> array(2) { [0]=> array(3) { ["name"]=> string(5) "admin" ["sizeOnDisk"]=> float(49152) ["empty"]=> bool(false) } [1]=> array(3) { ["name"]=> string(5) "local" ["sizeOnDisk"]=> float(32768) ["empty"]=> bool(false) } } } 

The MongoDB PHP Driver also seems to work:

$collection = (new Client('mongodb://' . getenv('MONGODB_HOST') . ':' . getenv('MONGODB_PORT')))->danqcms->pages;
$collection->find()->toArray();

Details

  • Phalcon Framework version: 3.4.2
  • Phalcon Incubator version: 3.4
  • PHP Version: 7.3.1
  • Operating System: MacOS, Docker Container running Debian
  • Server: Apache
@dfsoeten dfsoeten changed the title Segmentation Fault when using find() or creating instance of model Segmentation Fault when using find() or creating instance of model Feb 4, 2019
@ruudboon
Copy link
Member

ruudboon commented Feb 4, 2019

Phalcon 3.4.2 isn't compatible with PHP 7.3.
V4 for is but still in alpha and the mongo support is still part of a discussion here

@dfsoeten
Copy link
Author

dfsoeten commented Feb 4, 2019

Wasn't quite sure if my current setup was supported due to the message on the top of the page found here. Thanks.

EDIT: I've managed to fix the issue by downgrading to PHP 7.2!

@dfsoeten dfsoeten closed this as completed Feb 4, 2019
@lubber-de
Copy link
Contributor

Phalcon 3.4.3 is now available for PHP 7.3, so this might get re-opened again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants