Compare commits

..

1 Commits

Author SHA1 Message Date
Andrei V. Goryunov ca3bb2cb0a upgrade to wellrested v5.1.1, fix 2022-07-29 09:51:37 +03:00
2 changed files with 5 additions and 5 deletions

View File

@ -117,21 +117,21 @@ class UploadedFile implements UploadedFileInterface
* *
* @see http://php.net/is_uploaded_file * @see http://php.net/is_uploaded_file
* @see http://php.net/move_uploaded_file * @see http://php.net/move_uploaded_file
* @param string $path Path to which to move the uploaded file. * @param string $targetPath Path to which to move the uploaded file.
* @return void * @return void
* @throws InvalidArgumentException if the $path specified is invalid. * @throws InvalidArgumentException if the $path specified is invalid.
* @throws RuntimeException on any error during the move operation, or on * @throws RuntimeException on any error during the move operation, or on
* the second or subsequent call to the method. * the second or subsequent call to the method.
*/ */
public function moveTo($path) public function moveTo($targetPath)
{ {
if ($this->tmpName === null || !file_exists($this->tmpName)) { if ($this->tmpName === null || !file_exists($this->tmpName)) {
throw new RuntimeException("File {$this->tmpName} does not exist."); throw new RuntimeException("File {$this->tmpName} does not exist.");
} }
if (php_sapi_name() === 'cli') { if (php_sapi_name() === 'cli') {
rename($this->tmpName, $path); rename($this->tmpName, $targetPath);
} else { } else {
move_uploaded_file($this->tmpName, $path); move_uploaded_file($this->tmpName, $targetPath);
} }
$this->moved = true; $this->moved = true;
} }

View File

@ -278,7 +278,7 @@ class Router implements MiddlewareInterface
usort($matches, $compareByLength); usort($matches, $compareByLength);
} }
$bestMatch = $matches[0]; $bestMatch = array_values($matches)[0];
return $this->prefixRoutes[$bestMatch]; return $this->prefixRoutes[$bestMatch];
} }