Community
Participate
Working Groups
Created attachment 281733 [details] Illustration of the bug In recent versions of eclipse/PDT, trying to find references to variables or constants always return 0 references. For instance in the attached file (example from a real project), there is clearly references to $last_dir yet none is found. Finding references to functions and classes works. Access to the definition of all objects (variables, constants, functions and classes) works with the usual shortcut (Ctrl + left click or the contextual menu). I have tried several versions: - Eclipse 2019-09, PDT 7.0.0 installed with the official installer for linux - Eclipse 2019-12, PDT 7.0.0 installed with the official installer for linux - version provided by Fedora 31 (Eclipse 4.13/2019-09, PDT 6.2.0) but this version seems even more broken (probably a Fedora problem) It used to work with the version provided by Fedora 30 (Eclipse 4.11/2019-03, PDT 6.2.0). See also a discussion on PDT forum: https://www.eclipse.org/forums/index.php/m/1821207/.
Created attachment 281734 [details] Minimal working example I have tried with a fresh workspace and a new project which only contains the attached file. Same problems ( I can find references to the class, the method and the function but not to the variables or the constant).
Hi, thanks for report. I checked indexer code, and looks like variable usage isn't indexed, and never was probably due past performance problems. Currently PDT index only class fields reference (MyClass::$myField / MyClass::MY_CONST). For now You can only search for variable declaration (ctrl+h -> php search -> field + declarations) but I'm afraid that with lot's of false-positives. I'm marking as enhancement, entire indexing/search subsystem have to be revisited with new model, see also #558900 and #534691.
Thanks for digging into the problem. Are you sure that constants and variables were never indexed ? I'm almost sure that it used to work: I remember using this functionality to find references of constants across a moderate-size project and it worked like a charm (it was even the main reason for me to switch to Eclipse); I also more or less remember being able to find references to variables without too much false positives (at least in a file).
Just to mention that I update to Fedora 32 (using Eclipse 2020-03 from their repo) and the bug is still here.