PHP built in functions/classes etc. are not recognized

After a restart of PhpStorm it started to highlight all built in classes (e.g. \Exception) as undefined and it also doesn't hint php built in functions (e.g. \trim, \strtolower) while typing. It looks like it suddenly doesn't know native php :-) What settings should I check to make everything work again?

Thank you.

83 comments
Comment actions Permalink

Solution of Mykola Veriga worked: uninstall with the toolbox app and then a fresh install. In my case, all settings were automatically preserved.

0
Comment actions Permalink

Our developers are working on it: https://youtrack.jetbrains.com/issue/WI-54626. Unfortunately we're still can't see what's causing this.

0
Comment actions Permalink

I'm having the same problem with a fresh install on a brand new Mac, none of the suggested solutions help. What info can I provide Dmitry Tronin

0
Comment actions Permalink

Dmitry Tronin
I have tried that with no luck, I have also tried the other solution of cloning the stubs directory from GitHub and linking that in PHPStorm and the issue still persists. I was wondering if there was any info I could give you to help your developers who are looking at it, before I try reinstalling using JetBrainsToolbox.

0
Comment actions Permalink

If none of the above suggested methods help - that might be another issue. Could you please share the IDE logs with us via Help > Collect Logs and Diagnostic Data?

0
Comment actions Permalink

I'm fighting the same problem since updating in IntelliJ ultimate with the PHP plugin enabled. I've tried invalidating cache, restarting, etc.  All internal PHP functions show as undefined.  All projects are impacted.

0
Comment actions Permalink

Scott Moore, the way to fix that is the manual caches folder removal.

Rooster242, yes, it's normal, this is a stub of the application created by Toolbox, the actual application is located in ~/Library/Application Support/JetBrains/Toolbox/apps/PhpStorm.

0
Comment actions Permalink

I had the same problem today.

  1. Install Ubuntu 20.04
  2. Install jetbrains toolbox app
  3. install phpstorm 2020.2

Everything worked perfectly

The next day the problem occured.

What i did in the meantime:

I installed docker and docker compose. Of course i added my user to the docker group. That often f***s up my ssh config (permissions being reset by adduser command and the ssh client wont use the keys anymore until you fix the permissions of ~/.ssh). So i think it might be possible that this has to do with the problem.

ALSO: Invalidating the cache from inside phpstorm did not solve the problem. Deleting the whole cache-folder did!

So my suspicion: The invalidation does not delete the folder. If you delete the folder manually, phpstorm will re-create it as it should be and it works.

It does not make a whole lot of sense but yea - a fix would be to completly remove the cache directory if the user invalidates the cache.

0
Comment actions Permalink

Invalidating that cache did also not work for me.
I had to delete:

%LOCALAPPDATA%\JetBrains\PhpStorm2020.2\caches

0
Comment actions Permalink

Same here with version 2020.2 (Linux)

Cache clearing and disabling plugins did not help.

Did not try Arjan's suggestion.

PhpStorm 2020.2
Build #PS-202.6397.115, built on July 29, 2020
Licensed to xxxx
You have a perpetual fallback license for this version
Subscription is active until August 6, 2021
Runtime version: 11.0.7+10-b944.20 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.8.11-200.fc32.x86_64
GC: ParNew, ConcurrentMarkSweep
Memory: 725M
Cores: 8
Registry: run.processes.with.pty=TRUE

Current Desktop: GNOME

0
Comment actions Permalink

manually removing cache directory is the only solution that worked for me


https://youtrack.jetbrains.com/issue/WI-54626

0
Comment actions Permalink

Any movements here? Built-in functions are not defined.

0
Comment actions Permalink

Andrew, did you try a workaround with a manual cache removal already? 

0
Comment actions Permalink

On Windows i had the same issue.

First I tried all above solutions, none of em worked. 

Then I just registered the CLI Interpreter again in PHPstorm Settings->Languages & Frameworks -> PHP.

Now it is working for me.

0
Comment actions Permalink

Any news here? I have the same problem with phpstorm 2020.3 and 2020.4. I also tried to reinstall without plugins, nothing worked!

0
Comment actions Permalink

Had the same problem now again after the update to 2020.3. Had it already when updating to 2020.1.

All the steps that can be done inside PHPStorm didn't help, I had to delete the cache folder manually.

0
Comment actions Permalink

Same thing happened to me, upgrading from PHPStorm 2019 to PHPStorm 2020.3.2. Arjan Frans's solution was the only thing that finally worked.

0
Comment actions Permalink

Same issue on Ubuntu 20 with Phpstorm (2020.3.3) installed via snap store. Snap seemed to decide to update phpstorm by itself which proceeded to break everything. Manually deleting caches was the fix. Invalidating the cache from within the app didn't help.

0
Comment actions Permalink

I had the same issue.

I went to Settings-> Editor-> File Types and it turned out that *.php was listed under Text files not PHP for some reason. I changed that and it worked.

0
Comment actions Permalink

I had this problem ocour after I created functions.php file in src for symfony. Cache revalidation helped.

-1
Comment actions Permalink

Worked when I upgraded to

IntelliJ IDEA 2020.2 (Ultimate Edition)
Build #IU-202.6397.94, built on July 27, 2020
Runtime version: 11.0.7+10-b944.20 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.6
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: suggest.all.run.configurations.from.context=true
Non-Bundled Plugins: Dart, io.flutter, com.jetbrains.php, Pythonid

-1
Comment actions Permalink

I had to remove the cache manually on windows 10

 

C:\Users\user-pc\AppData\Local\JetBrains\PhpStorm2020.2\caches

 

Why the do we pay so much money for this bullshit?

-1
Comment actions Permalink

To everyone still affected: please try the latest suggestion posted here by me. If this won't help - please contact us directly over Help | Contact Support

-3

Please sign in to leave a comment.