Bug #77262 [Opn->Nab]: curl_file_create() failed with unicode filenames
| From: | ab@php.net | Date: | Sat, 08 Dec 2018 01:09:34 +0000 |
| Subject: | Bug #77262 [Opn->Nab]: curl_file_create() failed with unicode filenames | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218326@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77262&edit=1
ID: 77262
Updated by: ab@php.net
Reported by: sh-ya at ya dot ru
Summary: curl_file_create() failed with unicode filenames
-Status: Open
+Status: Not a bug
Type: Bug
Package: cURL related
Operating System: Windows 7
PHP Version: 7.3.0
Block user comment: N
Private report: N
New Comment:
Thanks for the report. The libcurl API is what is responsible for this behavior, as it doesn't
seem to support UNICODE Windows API. Please report this issue to the cURL project.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2018-12-07 13:52:08] sh-ya at ya dot ru
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 this bug report at https://bugs.php.net/bug.php?id=77262&edit=1