$target = $this->getTargetFile($directory, $name);
- if (!@move_uploaded_file($this->getPathname(), $target)) {
- $error = error_get_last();
- throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message'])));
+ set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
+ $moved = move_uploaded_file($this->getPathname(), $target);
+ restore_error_handler();
+ if (!$moved) {
+ throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error)));
}
@chmod($target, 0666 & ~umask());
$max = ltrim($iniMax, '+');
if (0 === strpos($max, '0x')) {
- $max = intval($max, 16);
+ $max = \intval($max, 16);
} elseif (0 === strpos($max, '0')) {
- $max = intval($max, 8);
+ $max = \intval($max, 8);
} else {
$max = (int) $max;
}