craftql icon indicating copy to clipboard operation
craftql copied to clipboard

Upgrade graphql-php version

Open rodrigosaraiva opened this issue 6 years ago • 18 comments

We are having problems with the version that you are using for the graphql-php package. Your package is using the version 0.11.0, and the new version 0.13.0 fix the following problems:

[-][-][-][error][yii\base\ErrorException:2] yii\base\ErrorException: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/vendor/webonyx/graphql-php/src/Validator/Rules/OverlappingFieldsCanBeMerged.php:355 [-][-][-][error][yii\base\ErrorException:2] yii\base\ErrorException: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/html/vendor/webonyx/graphql-php/src/Executor/Executor.php:532

rodrigosaraiva avatar Mar 01 '19 17:03 rodrigosaraiva

What version of PHP is this? I've held off on updating because the latest version of graphql-php requires PHP 7.1 which is more than CraftCMS requires (7.0). So, CraftQL is in a tough spot.

Related: I have a 2.x-dev version that I'm working on that would be the appropriate place to make this update, if I'm going to.

markhuot avatar Mar 01 '19 17:03 markhuot

The version is 7.2.11 for PHP and Craft 3.1.15. I received this nicely answer from graphql-php: https://github.com/webonyx/graphql-php/issues/450

rodrigosaraiva avatar Mar 01 '19 17:03 rodrigosaraiva

Okay, thanks @rodrigosaraiva. I'm going to exploring reving the version number on the 2.x branch and see if anything breaks. I'll let you know once that's done and you should be able to try it out.

markhuot avatar Mar 01 '19 18:03 markhuot

I'm still working on this. There are a number of backwards breaks that I need to work through before this is merged. I will keep you updated in this ticket as I work through it though.

markhuot avatar Mar 01 '19 22:03 markhuot

@markhuot Thank you Mark. We bought this plugin because we are working in a project to a bank, and it is very important to have it updated. For now we are working with manual changes on it. It is not a huge problem, but it will block us from update plugins for a while.

rodrigosaraiva avatar Mar 04 '19 10:03 rodrigosaraiva

@rodrigosaraiva, did you have any issues with the update? E.g., I know the Directive::FIELD class changed a bit and causes issues.

markhuot avatar Mar 04 '19 15:03 markhuot

I'm getting this error with PHP 7.1.26, Craft 3.1.21.1 and CraftQL 1.3.1. Is there a version of PHP and Craft that will work with this version of CraftQL? Or maybe a different version of CraftQL?

kellypacker avatar Apr 08 '19 23:04 kellypacker

Same problem here. PHP 7.3.4, Craft 3.1.26, CraftQL 1.3.2. Very frustrating, spent the entire day trying to fix this. :-( Any updates on the issue?

PhillipRichdale avatar May 09 '19 17:05 PhillipRichdale

The fix is to replace all the "continue;"s with "break;"s, as said in the PHP Warnings.

PhillipRichdale avatar May 10 '19 10:05 PhillipRichdale

hi i have the same problem with my graphql. I have this error that prevents me from advancing on my project. Please, how to solve this error because I galley in this moment

zimkha avatar Jul 01 '19 16:07 zimkha

It suddenly appeared on my end as well. I had it before and switching from php 7.3 to 7.2 resolved it back then.

But now I tried 7.3, 7.2, 7.1 and 7.0. Still no luck. Is there anything else I could do to resolve this?

---- Edit: I could solve it in my case by just disabling all php errors... But this is just a temporary and ugly solution.

Jones-S avatar Sep 11 '19 00:09 Jones-S

In a quick look over the landscape, it appears that you may probably actually still be running PHP 7.3.

  • I'd first try trashing /vendor, especially, trashing composer.lock(!!), and then doing composer install. This will at the least get you the components and dependencies from your composer.json actually to be in use...
  • if needed, you can also look answer here, its comments, and the next following answer also: https://stackoverflow.com/a/54192699

narration-sd avatar Sep 11 '19 00:09 narration-sd

@narration-sd Thanks for your answer. I have indeed 7.2 running. I checked with phpinfo(). I do have error_display enabled now, and it does work. I am not sure why. Maybe it wasn't 7.2 before? 🤷‍♂

Also it is a bit weird, because I told my MAMP not to display any errors, but the phpinfo says they are still enabled. So it all seems a bit messy here. Anyway, it's back, up and running and I am happy. 👍

Jones-S avatar Sep 11 '19 12:09 Jones-S

Well, good, if your happy :)

The ditch /vendor plus ditch composer.lock is a good safe bet though at any time, and could get you around some 'unusual' situations.

MAMP, though -- if it's not, or not always due to some need like machine reboot, etc., following your instructions as to which PHP to use, you'd have to deal with separately. You might talk with @jalendport about it; he's pretty sharp about things like this...

narration-sd avatar Sep 11 '19 14:09 narration-sd

missed stating the third step re: composer -- it's composer install after you remove /vendor and, crucially, composer.lock...I think composer update works in that case also....

narration-sd avatar Sep 11 '19 15:09 narration-sd

Yeah. I normally follow these steps as well. I think it was the first thing I did. Remove the packages, install them again. I dislike it though that I always have to add a new token and click myself through all the toggles to allow certain graphql access. I like that in the craft core graphql there is a toggle all button. 👍

Jones-S avatar Sep 11 '19 15:09 Jones-S

Well, can't help on the tokens; as they say in some film, 'it is what it is'...

I would talk to @jalendport, Jalen Davenport, though - he's also quite active on Craft Discord. and you can look up his handle there. By my observation, MAMP can be tricky, and you'd like a way to tie down this PHP version thing, seem after this episode. Anything you can make more solid, more happy...!

narration-sd avatar Sep 11 '19 15:09 narration-sd

Sure no worries. it is what it is. :) Thanks for the pointer.

Jones-S avatar Sep 11 '19 15:09 Jones-S