Skip to content
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

file_get_contents() false positive warning #132

Open
mr-macedawg opened this issue Aug 29, 2018 · 3 comments
Open

file_get_contents() false positive warning #132

mr-macedawg opened this issue Aug 29, 2018 · 3 comments

Comments

@mr-macedawg
Copy link
Contributor

The upgrade tool detects that the php function file_get_contents() is a part of the asset-storage probably since it starts with "file"

"file_get_contents(): Use new asset abstraction (https://docs.silverstripe.org/en/4/changelogs/4.0.0#asset-storage)"

I use file_get_content() for retrieving content from a JSON file.

@robbieaverill
Copy link
Contributor

To clarify, you're saying that the upgrader tool warns you for using file_get_contents() in your project .code, and that it's assuming you're using it to access SilverStripe assets and thus suggesting you use the asset abstraction API?

If that's the case then there are two ways we could perceive this:

  1. It's a good thing, because it'd catch the 80% use case. It's a warning, so it can safely be ignored.
  2. It's a bad thing because it's wrong.

I'd like to think that we should be aiming to fix this. It's probably too draconian to assume that all file_get_contents() calls are for loading assets.

@maxime-rainville
Copy link
Contributor

That's coming from this bit in framework's .upgrade.yml file.

  functions:
    'file_get_contents()':
      message: 'Use new asset abstraction'
      url: 'https://docs.silverstripe.org/en/4/changelogs/4.0.0#asset-storage'
    'file_put_contents()':
      message: 'Use new asset abstraction'
      url: 'https://docs.silverstripe.org/en/4/changelogs/4.0.0#asset-storage'

https://github.com/silverstripe/silverstripe-framework/blob/9ceef59e1b48ae2588e681853dfa696478de71ad/.upgrade.yml#L1315-L1321

A workaround, is too suppress the warning with a @skipUpgrade comment. Obviously that's going to be painful if you are making extensive use of a command the upgrader doesn't like.

I guess we could add some sort of way to suppress a specific warning project wide.

@dhensby
Copy link
Contributor

dhensby commented Oct 24, 2018

This sounds like a feature working as expected. It's there to provide guidance not be 100% accurate about your usage...

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

No branches or pull requests

5 participants