[PHP] Fix string length validation (#7953)

* Add a test case which reproduces the issue

https://github.com/swagger-api/swagger-codegen/issues/7846

* Change `strlen` -> `mb_strlen` in order to count the length correctly

* Regenerate the samples
This commit is contained in:
Akihito Nakano
2018-04-06 15:20:05 +09:00
committed by William Cheng
parent 37faaf9266
commit 4a5d16b236
8 changed files with 519 additions and 13 deletions

View File

@@ -271,7 +271,7 @@ class ObjectSerializer
// determine file name
if (array_key_exists('Content-Disposition', $httpHeaders) &&
preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . self::sanitizeFilename($match[1]);
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]);
} else {
$filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
}