Jake B.
Well-known member
- Affected version
- Latest
On line 186 of src/XF/Util/File.php
Could we get:
changed to:
or:
to suppress this warning, which I think will be much cleaner and more future proof than having to manually patch the library (especially since
fclose($fp)
is called even if $fp
is not a resource stream. I've found that, for some reason, the microsoft/azure-storage-blob
library runs fclose
on the handler within one of its functions (Specifically here), which causes a warning to be thrown within XenForo when attempting to hook up the flysystem Azure handler. Could we get:
PHP:
public static function copyFileToAbstractedPath($file, $abstractedPath, array $config = [])
{
$fp = fopen($file, 'r');
$result = \XF::app()->fs()->putStream($abstractedPath, $fp, $config);
fclose($fp);
return $result;
}
changed to:
PHP:
public static function copyFileToAbstractedPath($file, $abstractedPath, array $config = [])
{
$fp = fopen($file, 'r');
$result = \XF::app()->fs()->putStream($abstractedPath, $fp, $config);
if (get_resource_type($fp) === 'stream') {
fclose($fp);
}
return $result;
}
or:
PHP:
public static function copyFileToAbstractedPath($file, $abstractedPath, array $config = [])
{
$fp = fopen($file, 'r');
$result = \XF::app()->fs()->putStream($abstractedPath, $fp, $config);
@fclose($fp);
return $result;
}
to suppress this warning, which I think will be much cleaner and more future proof than having to manually patch the library (especially since
copyAbstractedPathToTempFile
already suppresses this, likely for the same reason