PHPStorm displays a message using "include" and "require"

3

For my IDE PHPStorm reason, this message appears with include and require :

  

Dynamic include expression 'require_once $ file' is not analyzed.
  Include expression is not resolved.

    
asked by anonymous 29.05.2016 / 22:09

1 answer

4

I think I can infer the problem.

The command makes the inclusion of code based on a variable, so PHPStorm, which is an IDE that tries to analyze as much as can happen with the code, can not go further in the analysis of this, only during execution would have conditions of knowing what will be even there. He gives science to this.

This code has several other problems.

It already starts with a race condition checking if a file exists, and may no longer exist between verification and invocation.

Then throws a meaningless exception with no relevant information.

And it still includes code not only conditionally, but already bad, but variable-based. It may even be the right thing to do, but it's rare. You have to know very well what you are doing, to understand all the consequences of this, you must have a good reason. If this variable comes from untrusted source, it opens a huge security hole.

I'm not going to talk about using SPL, because it's just my opinion.

    
29.05.2016 / 22:20