-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
Applying Patches Drupal8: [ErrorException] Array to string conversion #123
Comments
I haven't looked into it too far, but my guess is that one of your dependencies is adding the same patch that you're trying to add. Your composer.json finished successfully for me locally, but I had to remove your bitbucket repo and mekanismi/ckeditor_responsive_foundation from the requirements to get it to finish. Consider starting with the composer.json in mekanismi/ckeditor_responsive_foundation to see if it defines the same patch you have in your root composer.json. |
Hey and thanks for quick response! I'm pretty sure that this is not because of the patches being applied twice. Well they are, but defined only once still. I experimented a little, and found out that if I remove all patches from my composer.json, composer updates as it should. And what ever patch I try to add back, then that patch will throw this error. And ALL other patches that I once had in my composer.json gets applied as well. For example, I left only that drupal/crop patch, and ran composer update -v and still it tried to apply patches for core that weren't even present in composer.json.
And here's my patches section from composer.json:
So I'm starting to think that there's some caching going on that I'm not aware of, or something gets read twice. I'll continue experimenting. Cheers, Janne |
Hmm.. I added some code to get past this error on my local drupalvm.
With this added to 2 methods in Patches.php I got packages updated. Although, those patches are doubled on every patch I try to apply. I then thought that my local composer / DrupalVM is messed up and tested with our stage environment. Didn't get any errors, but those merged patches that I've removed from my composer.json are still present and composer tries to apply them. So I get quite some errors. For example:
Those patches are definitely NOT in active composer.json. Everything seems to be working, so I'm not really sure what's happening here. Cheers, Janne |
What if you remove all the patches from your root composer.json, and then set the |
I'm posting here to confirm that I am having the same problem. I followed the steps @jiisuominen seems to have done, and ended up at the same place, including observing composer attempting to apply patches that I just removed from the .json file (I had done rm composer.lock and composer clear-cache as well, I'm not sure where it could be remembering that). I also added this in two places ( lines 289 and 424) in Patches.php: And that seemed to fix it enough for me to get a .lock file. |
Nice one @rgristroph ! I did some researching and found out that this occurs only if vendor folder exists. If I delete vendor and run composer install, everything works as expected. That's why it worked on our deployments, even if we couldn't run install locally. Is there any way for me to patch this plugin automatically? Or do I have to setup separate repo for this fix? Cheers, |
Please open a pull request. |
@cweagans I opened a PR here: #124 As I note there, it's not a final fix, just a temporary hack. I might be able to dig into this more later this week though. @jiisuominen If you want to use my hack-patch to get things working temporarily, in your composer.json, in the "repositories" list, add an entry like this:
Then, in the "require" section, make the line
However keep in mind that I don't intend to maintain that repo, and all updates in this official repo. This is only useful for getting through a build process right now until there's a real fix. If you have to do this make a reminder or put a story in your next sprint to clean it up. |
I have the same error but only on our build servers which don't have a vendor dir... |
Hi, do we have any final fix or update for this issue? still having the issue. |
Hi all, my project seems to be not having this issue any more. It might be related to updating to Drupal 8.3.4. In any case, one of my co-workers tested removing the patch listed in my comment above, and we are not seeing the error any more. That makes it hard to figure out a better patch than the one I did. @sridharmula , @BramG , @jiisuominen -- are you folks still seeing these errors after Drupal 8.3.4 ? |
@rgristroph just updated to 8.3.4 and at least one removed patch wants to get applied, even if it's not present in composer.json. I will need to test more, but to this project I never used your patched version. |
I could reproduce the error. In my case a ctools patch failed to apply and then ctools had all the patches of all projects stored in installed.json. Not sure it was due to the failed thing, but the extra section definitely was wrong. AH. Yes, it is the wrong thing:
The above line marked is wrong, it should be:
because the above line would put the root's patches section into the extra thingy here, which is what happens. but even more clean would be to leave $extra alone and just have a variable for patches applied. On the other hand this is also wrong as the exception means this patch was not applied, but others are, so that its correct it should just not do this. And that also solves my other issue. |
Hi guys on last release 1.6.4 I have experimented this issue and happened when in project composer.json file I have declared a patch that also was declared in a dependency composer.json file. There was two same patch covered by a Drupal contrib module in it composer.json file which we previously declared on our main project composer.json file and when that happened this error display and cannot apply any patch. I just quick solved by removing our main project composer.json file patches declaration and keep the contrib modules lines which will end in the patched modules we expect. Maybe there is a way to handle this more smoothly but I don't know enough of composer-patches source code so leave this report for your evaluation. Thanks for your help. |
Same behavior as @citlacom |
I ran into this and had to do things in a specific order for it to work without issue:
Previously I did the module update first and then removed the patch and instead of the patch being removed from the |
I just updated core to 8.3.1 and updated modules and everything and ran composer update multiple times to get all things updated.
Then after few updates, I started to get this error.
I then added some debugging print_r's to Patches.php.
I printed content of that $url variable inside the patching loop @ line 288 of Patches.php.
And this is what I got:
It seems that those patches do get parsed twice, it doesn't matter what files I try to patch, the result is always the same.
Any idea on what might be causing this behavior?
Here's my composer.json with some privacy edits.
I think I was updating Paragraphs to 1.1, Entity Browser to 1.0, Dropzonejs to 1.0-alpha6 and Linkit to 4.3 if that has anything to do with anything.
Thanks for any assistance, our updates are stuck because of this, so any help is appreciated.
/ Janne
The text was updated successfully, but these errors were encountered: