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

php7.0 Version issue

iozkn opened this issue · comments

Hello,

I try to use package with symfony2.8 and php7.0 but there is an issue with dependecies i think. The error message is;

Fatal error: Uncaught TypeError: Return value of Doctrine\Common\Annotations\AnnotationRegistry::registerLoader() must be an instance of Doctrine\Common\Annotations\void, none returned in C:\inetpub\wwwroot\mongoTest\vendor\doctrine\annotations\lib\Doctrine\Common\Annotations\AnnotationRegistry.php:117 Stack trace: #0 C:\inetpub\wwwroot\mongoTest\app\autoload.php(10): Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(Array) #1 C:\inetpub\wwwroot\mongoTest\web\app_dev.php(21): require('C:\\inetpub\\wwwr...') #2 {main} thrown in C:\inetpub\wwwroot\mongoTest\vendor\doctrine\annotations\lib\Doctrine\Common\Annotations\AnnotationRegistry.php on line 117

I found the issue but I don't know how can I fix. the issue: php7 and doctrine/annotations (v1.6.0) not working together. And I try to use alcaeus/mongo-php-adapter v1.1.2 also 1.1.3 but not works.

I try many things but still not working. Can you help me please?

This issue is neither an issue with this adapter or doctrine/annotations, but rather your dependency udpate process. As is visible in composer.json for doctrine/annotations, it requires PHP 7.1: https://github.com/doctrine/annotations/blob/v1.6.0/composer.json#L16.

The fact that you're running annotations 1.6 on PHP 7.0 indicates an issue with your dependency update. This can be either one of the following:

  • You've run composer update on PHP 7.1 but deployed the code on PHP 7.0. If this is what you're doing, you should be adding a platform config in your composer.json
  • You've run composer update with --ignore-platform-reqs. This was previously suggested in the installation instructions, but is no longer recommended due to the issue you ran into. Please refer to the installation instructions in this libraries' README to see how to work around this.

Thank you. I was try to install with --ignore-platform-reqs .

"config": {
"bin-dir": "bin",
"platform": {
"php": "7.0.23",
"ext-mongo": "1.6.16",
"ext-mongodb": "1.2.0"
},
"sort-packages": true
},

This config fix the issue. Thank you again.