-
Notifications
You must be signed in to change notification settings - Fork 18
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
PHP 7 compatibility #64
Comments
Hi @asrob, Thanks for looking at Warden. We haven't tried it on PHP 7 as yet, so I wondered if this was a PHP version issue. I have just had a quick search for this error message and found the following issue with Mongodb-odm: alcaeus/mongo-php-adapter#58 and doctrine/DoctrineMongoDBBundle#351 which seemed related. Are you able to try it with an older version of PHP at all to see if this changes anything? Thanks |
Hi @asrob, Looking at the Mongodb driver details (https://docs.mongodb.com/ecosystem/drivers/php/), this may be an issue to do with the version of the driver that is being used. Our composer file details to use Are you able to update the mongodb package to use at least 1.1 to see if this then fixes this issue? Thanks |
Hi @mikeddeeson, I tried it, but it didn't solve this issue. The full output is the following:
|
OK thanks @asrob - I was hoping that might have been the answer 😄 . I'll have a look to see if I can find anything else that might cause this and will let you know |
I found this line https://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/DoctrineAnnotations.php#L42 |
Is it these lines which is causing the problem in the MongoDB ODM - if you comment them out does it work? I'm looking at the MongoDB ODB github to see if there are any issues around this as well |
Looking through the MongoDb ODB issue queue it does seem that that fix for not including those classes was added to cater for this issue. Can you debug your code a bit and see if it is actually include these classes for some reason - i.e. the check for the php version is not working correctly? |
This is because where you're defining your fields, in:
Rather than:
you need:
See: doctrine/mongodb-odm#1368 (i.e. loading of I did also upgrade to MongoDB ORM 1.1 for the PHP7 support, as you'd already noted. Other than that The install works fine after that and I'm prompted for username/password. If I can I'll submit a PR later, but I'll attempt to get Warden working first as I've not used it before... (This is on Debian 8.6, by the way, using the DotDeb PHP 7 packages.) |
Hi @wturrell, Thanks for this, that would make sense that it is the data typing on the document (I just haven't had got an environment currently to test with PHP7). If you can get it working a pull request would be appreciated as I can test it against the PHP 5.6 as well :) |
Symptom: Fatal error: Cannot use 'String' as class name as it is reserved in /Users/asrob/Sites/warden/vendor/doctrine/mongodb-odm/ lib/Doctrine/ODM/MongoDB/Mapping/Annotations/String.php on line 23 when running "composer install" This is because 'String' is a reserved word in PHP 7: http://php.net/manual/en/reserved.other-reserved-words.php Although there was a fix here which checked the PHP version... doctrine/mongodb-odm#1168 ... the String class is still dynamically loaded when referred to in a Docblock annotation, like this: @string (or @Bool etc.) Doctrine have deprecated over a dozen annotations like @string in favour of @field, where you must specify the type like this: /** * @field(type="string") */ protected $foo; NB: 'string' is the default type anyway. In Warden, it's @mongodb\Field... because of the 'use' statement Official docs for @field (and other annotations): http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/annotations-reference.html#field Allowed field types: http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/basic-mapping.html#doctrine-mapping-types
This isn't necessary to fix issue teamdeeson#64, but it provides compatibility with MongoDB drivers - see https://github.com/doctrine/mongodb-odm/releases Note this new version requires PHP 5.6+ Documentation suggests 1.0.x branch will lose support after Dec 2016.
Hi, I tried @wturrell's patch but it didn't work for me. I would attach a screenshot in order to you can see what happens. I suppose it should work on Linux, but I didn't tested on that. Here is the details about my environment: Installed PHP 7.0.14 via homebrew + a few extensions (php70-intl, php70-mongodb, php70-opcache, php70-solr)
|
@asrob I tested it on Debian, but I'm also able to run composer, including the post-(install|update) steps, without error on an El Capitan Mac (i.e. 10.11.6, Darwin Kernel 15.6.0, PHP 7.0.14) - by which I mean:
Googling the Class __PHP_Incomplete_Class has no unserializer error seems to throw up some (but by no means all) Symfony users who've resolved it by clearing the cache; either with php console, or deleting the contents of Edit: incidentally, if you were missing any crucial packages, like the php70-mongodb extension, you'd get a warning and composer wouldn't let you continue (it checks the dependencies beforehand). |
Hi @wturrell, Yes, you're right. I could test it on a VPS. Installation was fine, I'm going to try adding some sites now. So, +1 from me to this pull request! :) |
I've tested it on my local environment and works well. I just deleted Thanks again! |
I would propose this issue to be in beta5. :) |
Hi!
I tried to install warden (mondodb-32 branch) but I could not because of this error below. I use PHP 7.0 via homebrew, here is my installed packages:
$ php --version
$ composer --version
Error message:
The text was updated successfully, but these errors were encountered: