-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
Built-in functions marked as undefined #990
Comments
Have you modified any of the default settings? These definitions are bundled with the extension and controlled with the |
I hadn't, no. After I got the errors, I tried setting my php version to 7.3, with no observable effect. |
I'm having the same issue. Reverting to 1.3.5 fixed it for now. Only extension setting I have changed from default is |
I noticed the same issue. sqlsrv commands also started popping up red around this time. Reverting to 1.3.5 also fixed it for me. I noticed "sqlsrv" was no longer included in the stubs settings. However, adding it back did not resolve the issue, whereas rolling back the version did. |
Intelephense doesn't know about deprecated functions. |
@ilyaguy Set |
Same problem here, even with built-in php functions like |
I got the later versions working. I failed to notice a crucial step in the Quick Start:
Whoops. Doing so and restarting made everything work correctly. |
Is this still a problem in 1.4? |
This was still happening as of version 1.4.1/1.4.0. I decided to check my |
Happening for me on the following configuration:
Toggling either of the built-in language packages has no effect. Toggling the other PHP extensions has no effect. |
I just set Seems like changing the the PHP version setting rebuilt the relevant cache with whatever was initially missing? |
I am running the v1.5.4 of PHP Intelephense on the latest version of VSCode for Debian based installs and running into this issue. Specifically I am within a file that uses a namespace and anything (function, class, etc) in the global space is showing as undefined, when I define it as within the global space by adding a The error might be related to hitting save too quickly. If I reindex the workspace the error goes away but if I hit save (within say 4-5 seconds) and trigger a check of the file the error comes back, however if I wait a while before hitting save the error seems to stay away. I am using a huge code base with millions of lines of code so maybe it isn't finishing indexing and this is what causes the error? I found it in another thread but I have tried uninstalling and installing this extension from scratch but that did not fix it. |
I've got the exact same behavior here |
I'm seeing the same behaviour as well -- some built-in functions are throwing an
I've tried re-installing the extension and changing the PHP environment version; neither having an effect. I also have no other extensions installed which provide similar functionality, that may cause some sort of conflict. Intelephense: |
Same problem here. EDIT: uninstalling, installing an older version then upgrading to latest magically fixed the problem... |
I'm not sure if this is of any help, but I was having this problem right now, reindexed the workspace and the errors went away. For the sake of clarity (and perhaps future reference to myself) this is exactly what I did: I opened a file that was showing the wrong errors, then clicked on the option below and it all seems good now |
Hello, |
|
Hello, I'm having the same issue as well. Downgrading to 1.5.3 and reloading is a workaround. I don't have the "Index workspace" option. |
@asheroto |
Got it. I had to cancel indexing, restart the program, then start indexing, thanks! |
Yes, it fixed the problem in my case. Thank you! |
I have the same behavior with intelephense and neovim-lsp. |
It'd been a while since I touched PHP and when a small gig came my way figured I'd upgrade my tooling and workflows and tried Intelephense. Right out of the gate, built-in PHP functions are flagged as undefined. I thought I'd add a comment in case its helpful to note that I was starting from a blank slate PHP wise: the VSCode on the machine I'm using has nothing else related to PHP installed that could be conflicting with this, no prior versions or old settings, etc. Running MacOS with the Apple built-in php locally. Restarting VS Code did not help. Intelephense first thinks built-in functions belong to my namespace ("Undefined function 'ProjectNamesSpace\Plugin\defined'") and if I prefix them with a |
@firxworx have you tried "Index workspace" in the command palette as well? Admittedly I didn't try it when I initially experienced the issue, but others have reported success with it. I haven't been able to replicate the issue once more to test it myself, sadly. |
Anyone here suggest a better extension then? even though I paid for the pro version, doesn't seem like the author wants to respond or fix critical bugs like this. |
I'd like to solve the issue but I need to be able to reproduce it first. @fmp777 can you provide any output tab logs? Or a reproducible example/steps? Did you try uninstalling and reinstalling the extension? |
I'm new to vscode, so i'm not sure what you mean by output tab logs. Downgrading to previous version helped most my windows, because most of them are smaller code bases. The largest codebase window is still producing this error. As mentioned previously these are remote ssh - and I had to vastly increase my server side file watcher limit to get vscode to work. The sheer size may be the problem for intelephense? uninstall / install intelephense did not change the outcome |
Hello, I'm having similar issues, which led me here. I'm on the most recent version of VS Code and the most recent version of intelephense. Installed, restarted. Uninstalled, restarted, reinstalled, restarted - still didn't help. I've "re-indexed workspace" several times. Also, I don't know if it's related, but as a test project I created a simple php script with default php functions as well as some defined functions. The PHP functions still came up as undefined. As well, the custom functions I defined cannot be found either leading to autocompletion not working. Does it matter that I'm on the Apple M1 chip? I'm also new to VSCode, coming from PHPStorm. If you have a formal set of steps I can try to debug and report back, please let me know. |
It worked flawlessly until about 2 or 3 months ago. |
I’m on Apple M1 too. Not sure it should matter, but never know. |
Using a custom built computer with Intel i7-4790k 4GHz. |
There was an issue with apple M1 previously #1550 . You can also provide your own nodejs runtime with the It's hard to see a pattern here. There seems to be a various OS and vscode/intelphense versions. Please post if there is any obvious errors in the output tab: View -> Output -> intelephense. |
we're still having issued with this. in-built functions are showing up as undefined on my Mac OS + VS Code. |
Had same problem in v1.7.1 while using Laravel PHP. It was showing error on built-in functions. But just found the solution: go to extension setting |
I had the same issue when I manually added the |
Having this problem, I downgraded. Its only in one of my projects. Also interestingly, it only higlihgited some functions. Like date_default_timezone_set and json_decode. Those also didnt load up in my autocomplete. Also noteable that running top on the server I had ssh'd into was peggeing node at like 35+ CPU constantly. I would reindex, the errors would disappear, then on typing or saving something, the errors would reappear. Here's the debug console from when it is not working And one from after i downgraded: Oh its breaking again on the older version. just for json_encode and header, empty works ok hash doesnt work. base64_encode ... |
Hi all, After updating to a newer M1 Mac I had the same issue as described above and @toovy 's answer completely fixed the issue for me. I had defined stubs for Core and WordPress in my VSCode settings.json as follows:
It was only when I deleted all of the above that my definitions began to work again for core PHP functions like It's hard to say if this issue is specifically related to M1 Macs/MacOS or the WordPress snubs but by completely removing the stubs definitions in settings.json everything works - I get Intelephense tooltips for both WordPress features and also for core PHP functions. |
I don't have them set at all:
$ code --version
1.68.1
30d9c6cd9483b2cc586687151bcbcd635f373630
x64
Intelephense version:
What's weird is that this system is (VSCode-)synced to another computer that doesn't demonstrate this problem... (Note that is has picked up on a problem with
|
I can confirm that I had to install my own [Edit] That didn't last long. After a couple of hours the bogus errors (caused by the plugin's failure to find any of the classes the site is using) are back. |
A number of comments have indicated that downgrading the plugin solved the problem. How does one downgrade? |
Ctrl-Shift-X to get the Extensions pane up, search for the extension you want, click the Down Arrow next to Uninstall and select Install another version... and look for the version you're after. |
Thanks, Paul. Unfortunately the downgrade didn't solve the problem (nor did "reindexing"). Guess it's time to research a better plugin. |
Unlike Rory's situation, I had to add "Core" to "intelephense.stubs" in my vscode settings. Unfortunate this wasn't on by default. this is using v1.10.2 of the intelephense plugin on linux |
Describe the bug
Just recently, intelephense has started marking lots of function calls as undefined, for instance
is_null
andarray_map
.To Reproduce
Install version 1.3.6 or later. Seems to work fine in 1.3.5.
Expected behavior
Built-in functions are not flagged as undefined.
Screenshots
Platform and version
OS and Intelephense version.
MacOS 10.15. Versions mentioned above.
The text was updated successfully, but these errors were encountered: