comparison vendor/symfony/http-foundation/File/UploadedFile.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
220 return PHP_INT_MAX; 220 return PHP_INT_MAX;
221 } 221 }
222 222
223 $max = ltrim($iniMax, '+'); 223 $max = ltrim($iniMax, '+');
224 if (0 === strpos($max, '0x')) { 224 if (0 === strpos($max, '0x')) {
225 $max = intval($max, 16); 225 $max = \intval($max, 16);
226 } elseif (0 === strpos($max, '0')) { 226 } elseif (0 === strpos($max, '0')) {
227 $max = intval($max, 8); 227 $max = \intval($max, 8);
228 } else { 228 } else {
229 $max = (int) $max; 229 $max = (int) $max;
230 } 230 }
231 231
232 switch (substr($iniMax, -1)) { 232 switch (substr($iniMax, -1)) {
247 * 247 *
248 * @return string The error message regarding the specified error code 248 * @return string The error message regarding the specified error code
249 */ 249 */
250 public function getErrorMessage() 250 public function getErrorMessage()
251 { 251 {
252 static $errors = array( 252 static $errors = [
253 UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).', 253 UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',
254 UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.', 254 UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
255 UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.', 255 UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
256 UPLOAD_ERR_NO_FILE => 'No file was uploaded.', 256 UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
257 UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.', 257 UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
258 UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.', 258 UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
259 UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.', 259 UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
260 ); 260 ];
261 261
262 $errorCode = $this->error; 262 $errorCode = $this->error;
263 $maxFilesize = UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0; 263 $maxFilesize = UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0;
264 $message = isset($errors[$errorCode]) ? $errors[$errorCode] : 'The file "%s" was not uploaded due to an unknown error.'; 264 $message = isset($errors[$errorCode]) ? $errors[$errorCode] : 'The file "%s" was not uploaded due to an unknown error.';
265 265