GithubHelp home page GithubHelp logo

Comments (8)

bjori avatar bjori commented on July 19, 2024

What do you mean "silently fails"?
Does PHP just stop execution and nothing happen? That'd indicate it segfaults..

from mongo-php-library.

MarkisLt avatar MarkisLt commented on July 19, 2024

Code example:

<?php
    ini_set("display_errors",1);
    require_once 'vendor/autoload.php'; // include Composer goodies
    $manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
    $collection = new MongoDB\Collection($manager, "my_db.my_table");
    //$result = $collection->insertOne( [ 'name' => 'Hinterland', 'brewery' => 'BrewDog' ] );
    $cursor = $collection->find([ 'name' => 'Hinterland']); 
        echo "Searching for citizen => Iceland, verify Hayley is now Icelandic\n";
        foreach($cursor as $document) {
            var_dump($document);
        }
?>

/var/tmp/mongodb/src/libbson/src/bson/bson.c:1825 bson_init_static(): precondition failed: data
Aborted

from mongo-php-library.

bjori avatar bjori commented on July 19, 2024

Can you run the example in debug mode?
For example, say the PHP code above is in the filename example.php you'd run:

php -dmongodb.debug=stderr example.php

This would print out a lot of debug information.
If you could save it all to a file and upload/paste it here, it would help a lot, thanks!

from mongo-php-library.

MarkisLt avatar MarkisLt commented on July 19, 2024

[2015-11-26T06:59:57+00:00] PHONGO: DEBUG > Connection string: 'mongodb://localhost:27017'
[2015-11-26T06:59:57+00:00] PHONGO: TRACE > ENTRY: php_phongo_make_mongo_client():1729
[2015-11-26T06:59:57+00:00] PHONGO: DEBUG > Creating Manager, phongo-1.0.0[stable] - mongoc-1.2.0(bundled), libbson-1.2.0(bundled), php-5.6.14
[2015-11-26T06:59:57+00:00] mongoc: TRACE > ENTRY: mongoc_topology_description_init():51
[2015-11-26T06:59:57+00:00] mongoc: TRACE > EXIT: mongoc_topology_description_init():67
[2015-11-26T06:59:57+00:00] mongoc: TRACE > ENTRY: mongoc_server_description_init():88
[2015-11-26T06:59:57+00:00] mongoc: TRACE > EXIT: mongoc_server_description_init():122
[2015-11-26T06:59:57+00:00] cluster: TRACE > ENTRY: mongoc_cluster_init():1523
[2015-11-26T06:59:57+00:00] cluster: TRACE > EXIT: mongoc_cluster_init():1546
[2015-11-26T06:59:57+00:00] client: DEBUG > Using custom stream initiator.
[2015-11-26T06:59:57+00:00] PHONGO: TRACE > EXIT: php_phongo_make_mongo_client():1797
/var/tmp/mongodb/src/libbson/src/bson/bson.c:1825 bson_init_static(): precondition failed: data
Aborted

from mongo-php-library.

MarkisLt avatar MarkisLt commented on July 19, 2024

As I see $options is invalid, $query = new Query($filter, $options),
because when I do $query = new Query($filter) it works.

Output from $options:

Array
(
    [allowPartialResults] =>
    [batchSize] => 101
    [comment] =>
    [cursorType] => 0
    [limit] => 0
    [maxTimeMS] => 0
    [modifiers] => Array
        (
        )

    [noCursorTimeout] =>
    [oplogReplay] =>
    [projection] => Array
        (
        )

    [skip] => 0
    [sort] => Array
        (
        )

    [cursorFlags] => 0
)

from mongo-php-library.

ooglek avatar ooglek commented on July 19, 2024

I'm having the exact same problem with 0.2.0 of the library.

    "mongodb/mongodb": "^0.2.0"

mongodb

mongodb support => enabled
mongodb version => 1.0.1
mongodb stability => stable
libmongoc version => 1.2.0
libbson version => 1.2.0

Directive => Local Value => Master Value
mongodb.debug => no value => no value

I tried commenting out all of the variables returned by getFindOptions() method one by one, and re-running my Find(), but it still failed. As the OP said, if you modify _buildQuery to remove passing in the $options array, things succeed.

If I upgraded to v1.0.0-beta1, the problem went away.

Using > db.version() 3.0.7

from mongo-php-library.

bjori avatar bjori commented on July 19, 2024

Sorry for the lack of updates here.

I'm pretty sure this is fixed in the latest pecl/mongodb release, 1.1.0.

Could you confirm?

1.1.1 is also being released any moment now with PHP7 support, if you'd like to wait and try that out -- it has rewritten lot of this code path to simplify certain things.

from mongo-php-library.

jmikola avatar jmikola commented on July 19, 2024

Closing this out due to inactivity. Please follow-up if the issue still persists in the more recent releases of the library and driver (1.1.1 is the latest and includes PHP 7 support, and we should have a 1.1.2 release out soon).

from mongo-php-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.