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
Permission denied ... Kernel.php on line 486 #3067
Comments
What happens with How did you debug |
Here's the debug output
Sorry, I don't understand your question about me debugging that line. I did not. But that's the full error that it gives, it says Permission denied on that line. |
In the report I see You can open that file on that line and debug it. I think there will be more intell on your problem. |
I'm sorry, can you tell me what you mean by debug it? Do you mean step through with Xdebug? |
Ok, I think I see what you mean. I assumed it was erroring trying to load the Kernel.php file, but it looks like that line is responsible for loading the Symfony cache. It looks like it's trying to load cache from this path: C:\Users\Tim\AppData\Local\Temp/_rector/Rector_Core_HttpKernel_RectorKernelProd169155Container.php How do I fix permissions there? I've tried running the cmd prompt as an admin, but that has no effect. |
I don't work with Windows for ~8 years, so I have no idea. |
So I don't have a solution for this, but I'm going to close it anyway. The RectorKernel is telling Symfony to create the cache in That should be fine, I should have permission to that folder, since I can create files there. But I don't. I've tried changing the path to other places, and I've tried giving full control to every user, but nothing works. |
It's only thing that comes to my mind: -sys_get_temp_dir() . '/_rector';
+sys_get_temp_dir() . DIRECTORY_SEPARATOR . '_rector'; |
Good suggestion, but it didn't seem to help. |
Then you can add option to change this path via parameter. |
So I did some more sleuthing into that code in the Symfony Kernel, and I realized it's trying to read from a file that it has locked. And then I was able to find a GitHub issue from Symfony that references it. It is indeed a Symfony/PHP7.4 bug in Windows. Here's the GitHub issue: And here's the Symfony fix: I think if you upgrade Rector's Symfony version to 4.4.6 then it will be fixed. I appreciate your help in looking into it. |
Could you try that locally? If it works, send PR here to Awesome work 👏 👍 |
So I did a That fixed the error for me. Since rector's composer.json files allow you to get the fix, I'm not sure there's merit in restricting it to 4.4.6 or 5.0.6, but if you'd like me I will make the PR. |
Yes, go for it! |
rectorphp/rector-src@fa9a953 [Php80] Skip possible numeric string switch cond with all integer case cond on ChangeSwitchToMatchRector (#3067)
Bug Report
When running rector I started getting the following errors:
When run regular (rector/rector)
When run prefixed:
I made a new folder and then included rector via composer and nothing else:
composer require rector/rector-prefixed OR composer require rector/rector
Then I made a super simple PHP file in src called HelloWorld.php that's blank.
We started getting this error in our real setup when upgrading rector, but I hope the above is a simple enough way to replicate it.
So right now it's happening in our real, more complex project, and in these two super simple test cases. It's happening on multiple computers.
I've tried setting windows permissions to give full control of the files to everyone, but it hasn't helped.
These are all Windows computers. I do not get the error when doing same thing from Ubuntu.
If there are changes to be made, Rector will still make them. But it always put those two lines of error at the top, which breaks JSON parsing of the output.
The text was updated successfully, but these errors were encountered: