I understand Magento2 has replaced various filesystem PHP functions with their own safer version in Magento\Framework\Filesystem\Driver\File. For example get_file_contents should be called instead as $this->fileDriver->fileGetContents($url, false, $context)

Though am stuck on "stream_content_create" as there seems to be no alternative?

ie.with phpcs I get this error :

$context  = stream_context_create($options);
 157 | WARNING | [ ] The use of function stream_context_create() is discouraged

does anybody know what the replacement should be?

  • Can you provide reason why you need custom context? – KAndy Aug 13 '20 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.