Bug #77262 [NEW]: curl_file_create() failed with unicode filenames
| From: | sh-ya at ya dot ru | Date: | Fri, 07 Dec 2018 13:52:08 +0000 |
| Subject: | Bug #77262 [NEW]: curl_file_create() failed with unicode filenames | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-218313@lists.php.net to get a copy of this message | ||
From: sh-ya at ya dot ru
Operating system: Windows 7
PHP version: 7.3.0
Package: cURL related
Bug Type: Bug
Bug description:curl_file_create() failed with unicode filenames
Description:
------------
cURL cannot upload files with filenames containing unicode characters.
5.6.38, 7.0.32: upload is successful
7.1.25, 7.2.13, 7.3.0: upload failed
Test script:
---------------
$test_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR
. 'âââââPHP' . PHP_VERSION . PHP_OS . '.txt';
file_put_contents($test_file, 'test') or exit('file_put_contents
failed');
register_shutdown_function(function() use ($test_file) {
unlink($test_file);
});
$curl = curl_init('http://localhost/upload.php');
curl_setopt_array($curl, [
CURLOPT_POST => TRUE,
CURLOPT_SAFE_UPLOAD => TRUE,
CURLOPT_POSTFIELDS => ['file' => curl_file_create($test_file)],
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HEADER => TRUE
]);
$got = curl_exec($curl);
var_dump($got, curl_error($curl), curl_getinfo($curl), PHP_VERSION);
----------------
upload.php:
---
var_dump($_FILES);
Expected result:
----------------
HTTP/1.1 200 OK
Date: Fri, 07 Dec 2018 13:40:12 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 284
Content-Type: text/html; charset=utf-8
array(1) {
["file"]=>
array(5) {
["name"]=>
string(33) "âââââPHP7.3.0WINNT.txt"
["type"]=>
string(24) "application/octet-stream"
["tmp_name"]=>
string(29) "D:\TMP\php8BF9.tmp"
["error"]=>
int(0)
["size"]=>
int(4)
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=77262&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77262&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77262&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77262&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77262&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77262&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77262&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77262&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77262&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77262&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77262&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77262&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77262&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77262&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77262&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77262&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77262&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77262&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77262&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77262&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77262&r=mysqlcfg