Bug #78077 [NEW]: move_uploaded_file ignores stream_flush return value of reg. streamWrapper
| From: | daniel dot pernold at gmail dot com | Date: | Tue, 28 May 2019 09:22:07 +0000 |
| Subject: | Bug #78077 [NEW]: move_uploaded_file ignores stream_flush return value of reg. streamWrapper | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-221022@lists.php.net to get a copy of this message | ||
From: daniel dot pernold at gmail dot com
Operating system: Ubuntu 18.04
PHP version: 7.2.18
Package: Streams related
Bug Type: Bug
Bug description:move_uploaded_file ignores stream_flush return value of reg. streamWrapper
Description:
------------
PHP 7.2.17-0ubuntu0.18.04.1 (cli) (built: Apr 18 2019 14:12:38) ( NTS )
When using
move_uploaded_file with a stream wrapper url as
destination, the return value of the method stream_flush is ignored.
The function move_uploaded_file always returns true, even if
stream_flush returns false.
Test script:
---------------
class MyStreamWrapper
{
...
public function stream_write($data)
{
return 1;
}
public function stream_flush()
{
return false;
}
...
}
stream_wrapper_register('my-wrapper', \MyStreamWrapper::class, 0);
$res = move_uploaded_file($_FILES['uploaded_file']['tmp_name'],
'my-wrapper://' . basename($_FILES['uploaded_file']['name']));
stream_wrapper_unregister('my-wrapper');
echo $res ? 'true' : 'false';
Expected result:
----------------
false
Actual result:
--------------
true
--
Edit bug report at https://bugs.php.net/bug.php?id=78077&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78077&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78077&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78077&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=78077&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78077&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78077&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78077&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78077&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78077&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78077&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78077&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78077&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78077&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78077&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=78077&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78077&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78077&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78077&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78077&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78077&r=mysqlcfg