Skip to content

False error messages in Codeigniter 3 #677

Closed
Closed

Description

@ringerattila

When I develop in Codeigniter 3 PHP, the DEVSENSE report lot of errors, for e.g. undefined objects. The referenced objects are defined, no real errors, the code runs without any error. These are hundreds of false error messages (depending on project size). Even it makes false errors messages with a brand new Codeigniter installation - of course it contains no errors. I tried some other intellephense, all of them makes false error messages in Codeigniter 3.

Activity

  1. jakubmisek commented on Sep 29, 2024

    @jakubmisek
    Member

    Thank you for trying our tools, and for reporting the issue.

    We're aware that CodeIgniter has many broken (or not properly used) annotations across its codebase. It confuses the editor, code suggestions, and IntelliSense itself.

    Currently, we work basically one by one and adjust the problems; as a workaround, I can only suggest disabling full workspace-wide analysis (F1 -> Command Palette -> Workspace Analysis - "opened").

    Of course if you have a frequent case where a problem is falsely reported, please post a short reproducible sample and we will try to fix it first.

  2. self-assigned this
    on Sep 29, 2024
  3. ringerattila commented on Sep 29, 2024

    @ringerattila
    Author
  4. TheLordOfTheKings commented on Oct 11, 2025

    @TheLordOfTheKings

    Hi @jakubmisek,
    I can still see this bug exist with CI3 and latest VS code extension, what do you suggest? PHP IntelliSense works great though.
    It's a shame, CI is a great framework that receive no love from you guys.

  5. jakubmisek commented on Oct 11, 2025

    @jakubmisek
    Member

    @TheLordOfTheKings thank you for reminding.

    There are many falsy warnings, simply because CI3 has many wrong PHPDoc type annotations. We've tried other IDEs, and the errors are basically the same.

    I would be happy to make CI3 development a great experience in VSCode.

    • Do you think it makes sense to prepare pull requests to the CI repositories, fixing the wrong PHPDoc annotations?
    • We can prepare stubs with correct type annotations, which would tell the IDE the correct types. It would require some maintenance, though.
  6. TheLordOfTheKings commented on Oct 12, 2025

    @TheLordOfTheKings

    @jakubmisek Thanks for responding so quickly,
    I would really appreciate it if you could make a stub for CI3, nothing fancy of course, just the same level of analysis as Intelliphense has would be nice.

  7. jakubmisek commented on Oct 12, 2025

    @jakubmisek
    Member

    May I ask what the difference is with Intellephense? AFAIK, we just report more problems, but code completion is almost the same.

  8. TheLordOfTheKings commented on Oct 12, 2025

    @TheLordOfTheKings

    I think it can also autocomplete internal functions like xss_clean(), but I'm not sure since I don't have a Pro license. is it possible with PHP Tools too?
    $foo = $this->security->xss_clean($bar);

  9. jakubmisek commented on Oct 13, 2025

    @jakubmisek
    Member

    I'm afraid that all the other IDEs and extensions for VSCode I've tried behave similarly.

    $this->security // is always treated as an `object`

    Therefore, there is no completion after $this->security->.

    But that doesn't mean we can't do it :)

  10. jakubmisek commented on Oct 20, 2025

    @jakubmisek
    Member

    @TheLordOfTheKings there is pre-release 1.62.17984 with basic CI3 support. It now resolves most of the system classes, incl. $this->security:

    Image

    Please feel free to try the pre-release version, and let me know how it works, and what else would be helpful to add.

  11. TheLordOfTheKings commented on Oct 23, 2025

    @TheLordOfTheKings

    @jakubmisek Sorry I just saw your response,
    Wow, again thanks man. I hope to see same level of support (autocomplete and analyze) that we have for Laravel but for CI3/4. Is it already there or will be there @jakubmisek ? I'm just excited.

  12. TheLordOfTheKings commented on Oct 24, 2025

    @TheLordOfTheKings
    Image

    Dear @jakubmisek , would you take a look at CodeLens? 1- It can't find all the references etc... and by right-click->Find all references it opens up VScode default sidebar instead of Peek references.

  13. jakubmisek commented on Oct 24, 2025

    @jakubmisek
    Member

    @TheLordOfTheKings thanks!

    • the code completion in CI3 after various dynamic properties (like $this->security->) is already available in the latest Pre-Release.
    • find all references (and the code lenses) may be confused by the CI3 class aliases - I think there is something like "fake" namespaces - I'll take a look at how it works
    • find all references (and the code lenses) rely on the resolved types; I'd need an example where CI_booking is used in the code (probably a dynamic factory method load_class or some find method - which we need to handle explicitly)
  14. 5 remaining items

  15. TheLordOfTheKings commented on Oct 25, 2025

    @TheLordOfTheKings
    Image

    Hi dear @jakubmisek, I think you mean this. ($data contains the user row from DB)

  16. jakubmisek commented on Oct 25, 2025

    @jakubmisek
    Member

    @TheLordOfTheKings, I was referring to this:

    Image

    Where is it defined? How to tell CI3 to add the property userdata to your controller?
    Is it a model specified in your autoload.php?

  17. jakubmisek commented on Oct 25, 2025

    @jakubmisek
    Member

    @TheLordOfTheKings please try the pre-release 1.62.18011 - we have added more support for CI3, and a bonus completion for model names in ->load->model( '' )!

    EDIT: needs a hotfix, working on it

  18. TheLordOfTheKings commented on Oct 25, 2025

    @TheLordOfTheKings

    @TheLordOfTheKings, I was referring to this:
    Where is it defined? How to tell CI3 to add the property userdata to your controller? Is it a model specified in your autoload.php?

    It's part of the session library, and once you assign it with set_userdata(), it's accessible globally.

  19. jakubmisek commented on Oct 25, 2025

    @jakubmisek
    Member

    @TheLordOfTheKings, I see! thank you for the explanation.

  20. jakubmisek commented on Oct 30, 2025

    @jakubmisek
    Member

    Sneakl peek - the next update adds completion for CI3 view names:
    Image

  21. TheLordOfTheKings commented on Oct 31, 2025

    @TheLordOfTheKings
    Image

    Thanks dear @jakubmisek , it's getting almost perfect.
    The only problem I see now it lack the analyzing of the libraries, internal or custom:

    $this->template->views('pricing/pricing', $data); // It's a simple custom library
    $this->userdata->user_level == 'admin'); // From session library
    $this->upload->do_upload('file')....

    Do you also think IntelliPHP AI needs some better training for CI?

    P.S: With the support for Laravel and CI in PHP Tools, I think PHPStorm is not the best IDE anymore.
    Again thanks to you guys.

  22. jakubmisek commented on Oct 31, 2025

    @jakubmisek
    Member

    Thank you @TheLordOfTheKings, I appreciate the details and your endorsement!

    Libraries are still on our list - work in progress. I hope they'll get supported in the next update.

    IntelliPHP was actually trained on CI3 code - do you notice anything that doesn't make sense, or causes inconveniences?

  23. jakubmisek commented on Oct 31, 2025

    @jakubmisek
    Member

    @TheLordOfTheKings, we have basic support for libraries prepared, but still struggling with $this->userdata where it comes from.

    The official documentation of CI3 does not mention that the session library adds something to the Controller itself: https://www.codeigniter.com/userguide3/libraries/sessions.html

    and when debugging, the object does not have it either:

    Image
  24. TheLordOfTheKings commented on Oct 31, 2025

    @TheLordOfTheKings

    @jakubmisek I don't know, it's just there! This is my Auth controller which all other controllers extend it.

    Image
  25. gpibarra commented on Dec 10, 2025

    @gpibarra

    When I try to load a custom library according to the documentation https://www.codeigniter.com/userguide3/general/creating_libraries.html, for example $this->load->library('someclass'); (located in application/libraries/Someclass.php), it then tries to define the property as (dynamic) CI_someclass CI_Controller::$someclass when it should be (dynamic) Someclass CI_Controller::$someclass

  26. jakubmisek commented on Dec 12, 2025

    @jakubmisek
    Member

    @gpibarra thank you for pointing this out. Fixed in the next update.

  27. TheLordOfTheKings commented on Dec 12, 2025

    @TheLordOfTheKings

    Hi @jakubmisek, auto-completion for custom libraries functions and methods aren't available either which i wanted to mention.
    Thanks.

  28. jakubmisek commented on Dec 12, 2025

    @jakubmisek
    Member

    Hi @jakubmisek, auto-completion for custom libraries functions and methods aren't available either which i wanted to mention. Thanks.

    that is related to #677 (comment). should be also fixed in the next update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions