alcaeus / mongo-php-adapter

:link: Adapter to provide ext-mongo interface on top of mongo-php-library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MongoDB\generate_index_name method doesn't exist.

d-soerensen opened this issue · comments

There's an issue with the createIndex method inside `lib/mongo/MongoCollection.php', where in the event that the '$options' array has no property called 'name' it'll call an undefined method 'generate_index_name' from the 'MongoDB' package.

image

Additionally there's a similar error where the 'deleteIndex' method calls the same 'generate_index_name' if the '$keys' argument is an array.

image

The error I am facing:

Error Object
    (
        [message:protected] => Call to undefined function MongoDB\generate_index_name()
        [string:Error:private] => 
        [code:protected] => 0
        [file:protected] => /var/www/html/api/application/libraries/vendor/alcaeus/mongo-php-adapter/lib/Mongo/MongoCollection.php
        [line:protected] => 600
        [trace:Error:private] => Array
            (
                [0] => Array
                    (
                        [file] => /var/www/html/api/application/libraries/vendor/alcaeus/mongo-php-adapter/lib/Mongo/MongoGridFS.php
                        [line] => 340
                        [function] => createIndex
                        [class] => MongoCollection
                        [type] => ->
                        [args] => Array
                            (
                                [0] => Array
                                    (
                                        [files_id] => 1
                                        [n] => 1
                                    )

                                [1] => Array
                                    (
                                        [unique] => 1
                                    )
                            )
                    )

                [1] => Array
                    (
                        [file] => /var/www/html/api/application/libraries/vendor/alcaeus/mongo-php-adapter/lib/Mongo/MongoGridFS.php
                        [line] => 236
                        [function] => createChunksIndex
                        [class] => MongoGridFS
                        [type] => ->
                        [args] => Array
                            (
                            )
                    )

                [2] => Array
                    (
                        [file] => /var/www/html/api/application/libraries/vendor/sokil/php-mongo/src/GridFS.php
                        [line] => 59
                        [function] => storeFile
                        [class] => MongoGridFS
                        [type] => ->
                        [args] => Array
                            (
                                [0] => /var/www/html/api/uploads/form_logo/icon1.png
                                [1] => Array
                                    (
                                    )
                            )
                    )

You can refer this PR mongodb/mongo-php-library@c4569a1 for further details.

Thanks for the report. A fix will be released shortly; in the meantime please stick with mongodb/mongodb 1.15 or lower.