Skip to content

Commit

Permalink
Merge pull request #4 from magento-commerce/imported-magento-magento-…
Browse files Browse the repository at this point in the history
…coding-standard-198

[Imported] Discourage local-FS-only methods
  • Loading branch information
sivaschenko authored Dec 3, 2020
2 parents b74f41f + 98e9fff commit e1eb38e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Magento2/Sniffs/Functions/DiscouragedFunctionSniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Rule: getimagesize() is discouraged

## Reason

[getimagesize](https://www.php.net/manual/en/function.getimagesize.php) function works only with local and supported streams.
With introduction of more advanced storages, like AWS S3 or Azure Blob Storage this function will cause issues where file is not accessible.

## How to fix

[getimagesizefromstring](https://www.php.net/manual/en/function.getimagesizefromstring.php) can be used instead to retrieve all the information from file.
This function works with data strings, so you should read the file content using specific adapter before using it.

0 comments on commit e1eb38e

Please sign in to comment.