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

Hello, I have this same problem.

Phpstorm is complaining that is_numeric is an unknown/undefined function.

I have gone to "Settings/Languages & Frameworks/PHP/PHP Runtime/Sync Extensions with Interpreter." but this doesn't fix it.

I have coding for PHP 7.2 and have pointed the CLI interpreter to a PHP 7.2 executable. What else can I do?

Thank you

 

0
Comment actions Permalink

Elliot, could you please show the context? I just tried "is_numeric" function on a simple example in PhpStorm and no warnings are shown. Moreover, autocomplete is working for it.

0
Comment actions Permalink

It happened to me after running an update. David's method cleared it up.

0
Comment actions Permalink

Please try disabling all custom plugins at Settings | Plugins > click on a gear icon > "Disable All Downloaded Plugins", restart IDE and check the issue after that. 

0
Comment actions Permalink

I've tried disabling all plugins with built-in, cache clear, removing idea project dir. No luck!

0
Comment actions Permalink

No luck. But I've just left my PC for few minutes and it works! Some background process...

0
Comment actions Permalink

Same here :(

IntelliJ IDEA 2020.1.4 (Ultimate Edition)
Build #IU-201.8743.12, built on July 21, 2020
Runtime version: 11.0.7+10-b765.65 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, Pythonid, com.jetbrains.php

0
Comment actions Permalink

Same issue after updating to 2020.2. I tried to delete all plugins folders as you mentioned, delete .idea file of my project, restore default settings, reinstall PHPStorm... None of these solutions work.

 

Edit: The solution proposed by Arjan Frans temporarily solves the problem, thanks.

0
Comment actions Permalink

Arjan Frans thank you that actually helped!

0
Comment actions Permalink

Dmitry Tronin my PHPStorm is installed as a standalone app and "Core" PHP runtime is enabled. FYI, the solution proposed by Arjan Frans solves the problem.

 

PhpStorm 2020.2
Build #PS-202.6397.115, built on July 29, 2020
Licensed to La Coopérative des Tilleuls / Baptiste Meyer
You have a perpetual fallback license for this version
Subscription is active until July 30, 2021
Runtime version: 11.0.7+10-b944.20 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.5
GC: ParNew, ConcurrentMarkSweep
Memory: 4062M
Cores: 4
Registry: run.processes.with.pty=TRUE

 

0
Comment actions Permalink

Thanks for the info, but it's still not clear how did it happen. If anyone affected could share their logs via Help > Collect Logs and Diagnostic Data with us that would be great. 

0
Comment actions Permalink

Thanks, downloaded.

0
Comment actions Permalink

Logs are looking alright.

Could you please:

1) attach a screenshot of File | Settings | Languages & Frameworks | PHP > PHP Runtime > Core 

2) share your project's /.idea folder

0
Comment actions Permalink

Thanks. Do you have this problem in one particular project? What if you create an empty project - would the problem reoccur there?

0
Comment actions Permalink

Hello !

I've got the same problem, tried everything said above.

It happens in every projects (i even tried to create an empty project as you mentioned, same problem)

0
Comment actions Permalink

I just created a new project and the problem reoccurs. Sorry :(

e.g.

0
Comment actions Permalink

I see you've tried to reinstall the app: how exactly did you do this? Did you remove the app entirely with sudo rm -rf /Applications/PhpStorm.app?

0
Comment actions Permalink

I did this:

rm -rf /Applications/PhpStorm.app/

rm -rf ~/Library/Application\ Support/JetBrains/

rm -rf ~/Library/Application\ Support/PhpStorm*

rm -rf ~/Library/Caches/JetBrains/

rm -rf ~/Library/Caches/PhpStorm*

rm -rf ~/Projects/my-project/.idea

But maybe I forgot something because if I remember correctly my previous settings (theme, font, IDE sync, etc) always seemed to be there. I had to reset PHPStorm to default settings after reinstalling.

0
Comment actions Permalink

Please check the following:

1) Do you have PHP Runtime node under your Project view?

2) please check that you have a php.jar file at your IDE installation location. On Mac it's /Applications/PhpStorm.app/Contents/plugins/php/lib/. The file is 31,9MB as seen on a screenshot.

0
Comment actions Permalink

Everything looks good on this side:

0
Comment actions Permalink

Thanks! Notice there are no arrows against folders on your screenshot. It means that IDE is having troubles opening those files.

The ls -la output also differs a bit: php.jar on your installation has extended attributes. Please try removing them with xattr -c /Applications/PhpStorm.app/Contents/plugins/php/lib/php.jar

0
Comment actions Permalink

I removed the extended attributes but nothing changes. Even after restarting PHPStorm.

0
Comment actions Permalink

Could you please check if you can open the php.jar with "Archive Utility" app and browse it?

0
Comment actions Permalink

It works fine:

0
Comment actions Permalink

If anyone still has the issue and did not clear up the caches manually, please archive the idea.system.path folder, the idea.config.path folder, collect the logs (Help | Collect Logs and Diagnostic Data) and upload all of this here sharing the upload ID.
We need something we can reproduce the issue with badly. Thank you so much!

0
Comment actions Permalink

I have exactly the same issue. I am on Ubuntu with PHPStorm installed via Snap. Only project libraries are recognized. Functions like substr are all unavailable. Tried invalidate caches and some other suggestions, didn't work.

0
Comment actions Permalink

Maybe this helps: when I go to the composer tab in my settings, I see an endless spinner below the composer path. I am also sure this was not the case before the update. As a consequence, I cannot press the apply button and my changes are not taken into account. These things could be linked? Composer is also about external libraries.

0
Comment actions Permalink

Guys, we have one more question, as we cannot figure out what caused the issue.
Did any of you manage to solve the problem by simply removing the caches folder, without re-installing PhpStorm?

0

Please sign in to leave a comment.