comparison vendor/symfony/http-foundation/File/File.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
91 */ 91 */
92 public function move($directory, $name = null) 92 public function move($directory, $name = null)
93 { 93 {
94 $target = $this->getTargetFile($directory, $name); 94 $target = $this->getTargetFile($directory, $name);
95 95
96 if (!@rename($this->getPathname(), $target)) { 96 set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
97 $error = error_get_last(); 97 $renamed = rename($this->getPathname(), $target);
98 throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message']))); 98 restore_error_handler();
99 if (!$renamed) {
100 throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error)));
99 } 101 }
100 102
101 @chmod($target, 0666 & ~umask()); 103 @chmod($target, 0666 & ~umask());
102 104
103 return $target; 105 return $target;