浏览代码

Merge branch 'master' into acl

IamPersistent 14 年之前
父节点
当前提交
22fd08531c
共有 47 个文件被更改,包括 124 次插入278 次删除
  1. 2 0
      UPDATE.md
  2. 1 1
      src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
  3. 0 1
      src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
  4. 0 4
      src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
  5. 0 4
      src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php
  6. 1 1
      src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php
  7. 2 2
      src/Symfony/Component/BrowserKit/Cookie.php
  8. 1 1
      src/Symfony/Component/Config/Definition/ArrayNode.php
  9. 1 1
      src/Symfony/Component/Config/Definition/PrototypedArrayNode.php
  10. 3 3
      src/Symfony/Component/Console/Formatter/OutputFormatter.php
  11. 1 1
      src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php
  12. 1 1
      src/Symfony/Component/Console/Input/InputInterface.php
  13. 3 3
      src/Symfony/Component/DependencyInjection/Alias.php
  14. 1 1
      src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php
  15. 1 1
      src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
  16. 1 1
      src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php
  17. 2 2
      src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php
  18. 1 1
      src/Symfony/Component/DependencyInjection/ContainerBuilder.php
  19. 1 1
      src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
  20. 3 3
      src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
  21. 1 1
      src/Symfony/Component/DependencyInjection/Reference.php
  22. 1 1
      src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php
  23. 1 1
      src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php
  24. 1 1
      src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
  25. 1 1
      src/Symfony/Component/Form/Extension/Core/Type/RadioType.php
  26. 1 1
      src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php
  27. 1 1
      src/Symfony/Component/Form/FormInterface.php
  28. 13 91
      src/Symfony/Component/HttpFoundation/File/File.php
  29. 31 57
      src/Symfony/Component/HttpFoundation/File/UploadedFile.php
  30. 2 1
      src/Symfony/Component/HttpFoundation/FileBag.php
  31. 0 1
      src/Symfony/Component/HttpFoundation/Request.php
  32. 2 2
      src/Symfony/Component/Locale/Stub/DateFormat/FullTransformer.php
  33. 8 8
      src/Symfony/Component/Locale/Stub/StubCollator.php
  34. 6 6
      src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php
  35. 2 2
      src/Symfony/Component/Locale/Stub/StubLocale.php
  36. 15 15
      src/Symfony/Component/Locale/Stub/StubNumberFormatter.php
  37. 1 1
      src/Symfony/Component/Security/Core/SecurityContext.php
  38. 1 1
      src/Symfony/Component/Security/Core/SecurityContextInterface.php
  39. 1 1
      src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
  40. 1 1
      src/Symfony/Component/Validator/ValidatorFactory.php
  41. 1 1
      tests/Symfony/Tests/Component/Form/Extension/Core/Type/ChoiceTypeTest.php
  42. 0 1
      tests/Symfony/Tests/Component/Form/Extension/Core/Type/FormTypeTest.php
  43. 4 45
      tests/Symfony/Tests/Component/HttpFoundation/File/FileTest.php
  44. 1 1
      tests/Symfony/Tests/Component/HttpFoundation/File/UploadedFileTest.php
  45. 0 1
      tests/Symfony/Tests/Component/HttpFoundation/RequestTest.php
  46. 1 1
      tests/Symfony/Tests/Component/HttpKernel/KernelTest.php
  47. 1 1
      tests/Symfony/Tests/Component/Yaml/Fixtures/YtsTypeTransfers.yml

+ 2 - 0
UPDATE.md

@@ -9,6 +9,8 @@ timeline closely anyway.
 PR12 to beta1
 -------------
 
+* The `File::getWebPath()` and `File::rename()` methods have been removed.
+
 * The `session` configuration has been refactored:
 
   * The `class` option has been removed (use the `session.class` parameter

+ 1 - 1
src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

@@ -33,7 +33,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
     /**
      * Returns whether Doctrine 2 metadata exists for that class
      *
-     * @return boolean
+     * @return Boolean
      */
     protected function isMappedClass($class)
     {

+ 0 - 1
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

@@ -39,7 +39,6 @@ class Configuration implements ConfigurationInterface
             ->children()
                 ->scalarNode('cache_warmer')->defaultValue(!$this->debug)->end()
                 ->scalarNode('charset')->end()
-                ->scalarNode('document_root')->end()
                 ->scalarNode('error_handler')->end()
                 ->scalarNode('exception_controller')->defaultValue('Symfony\\Bundle\\FrameworkBundle\\Controller\\ExceptionController::showAction')->end()
                 ->scalarNode('ide')->defaultNull()->end()

+ 0 - 4
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

@@ -65,10 +65,6 @@ class FrameworkExtension extends Extension
             $container->setParameter('kernel.charset', $config['charset']);
         }
 
-        if (isset($config['document_root'])) {
-            $container->setParameter('document_root', $config['document_root']);
-        }
-
         if (isset($config['error_handler'])) {
             if (false === $config['error_handler']) {
                 $container->getDefinition('error_handler')->setMethodCalls(array());

+ 0 - 4
src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

@@ -56,10 +56,6 @@ class FrameworkBundle extends Bundle
             $this->container->get('error_handler');
         }
 
-        if ($this->container->hasParameter('document_root')) {
-            File::setDocumentRoot($this->container->getParameter('document_root'));
-        }
-
         if (file_exists($this->container->getParameter('kernel.cache_dir').'/autoload.php')) {
             $classloader = new MapFileClassLoader($this->container->getParameter('kernel.cache_dir').'/autoload.php');
             $classloader->register(true);

+ 1 - 1
src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php

@@ -105,6 +105,6 @@ class GlobalVariables
      */
     public function getDebug()
     {
-        return (bool) $this->container->getParameter('kernel.debug');
+        return (Boolean) $this->container->getParameter('kernel.debug');
     }
 }

+ 2 - 2
src/Symfony/Component/BrowserKit/Cookie.php

@@ -38,8 +38,8 @@ class Cookie
      * @param  string  $expires  The time the cookie expires
      * @param  string  $path     The path on the server in which the cookie will be available on
      * @param  string  $domain   The domain that the cookie is available
-     * @param  bool    $secure   Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client
-     * @param  bool    $httponly The cookie httponly flag
+     * @param  Boolean $secure   Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client
+     * @param  Boolean $httponly The cookie httponly flag
      *
      * @api
      */

+ 1 - 1
src/Symfony/Component/Config/Definition/ArrayNode.php

@@ -126,7 +126,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
     /**
      * Checks if the node has a default value.
      *
-     * @return boolean
+     * @return Boolean
      */
     public function hasDefaultValue()
     {

+ 1 - 1
src/Symfony/Component/Config/Definition/PrototypedArrayNode.php

@@ -97,7 +97,7 @@ class PrototypedArrayNode extends ArrayNode
     /**
      * Checks if the node has a default value.
      *
-     * @return boolean
+     * @return Boolean
      */
     public function hasDefaultValue()
     {

+ 3 - 3
src/Symfony/Component/Console/Formatter/OutputFormatter.php

@@ -26,7 +26,7 @@ class OutputFormatter implements OutputFormatterInterface
     /**
      * Initializes console output formatter.
      *
-     * @param   boolean $decorated  Whether this formatter should actually decorate strings
+     * @param   Boolean $decorated  Whether this formatter should actually decorate strings
      * @param   array   $styles     Array of "name => FormatterStyle" instance
      *
      * @api
@@ -87,7 +87,7 @@ class OutputFormatter implements OutputFormatterInterface
      *
      * @param   string  $name
      *
-     * @return  boolean
+     * @return  Boolean
      *
      * @api
      */
@@ -217,7 +217,7 @@ class OutputFormatter implements OutputFormatterInterface
      *
      * @param   string  $string
      *
-     * @return  Symfony\Component\Console\Format\FormatterStyle|boolean false if string is not format string
+     * @return  Symfony\Component\Console\Format\FormatterStyle|Boolean false if string is not format string
      */
     private function createStyleFromString($string)
     {

+ 1 - 1
src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php

@@ -53,7 +53,7 @@ interface OutputFormatterInterface
      *
      * @param   string  $name
      *
-     * @return  boolean
+     * @return  Boolean
      *
      * @api
      */

+ 1 - 1
src/Symfony/Component/Console/Input/InputInterface.php

@@ -97,7 +97,7 @@ interface InputInterface
     /**
      * Is this input means interactive?
      *
-     * @return bool
+     * @return Boolean
      */
     function isInteractive();
 }

+ 3 - 3
src/Symfony/Component/DependencyInjection/Alias.php

@@ -20,7 +20,7 @@ class Alias
      * Constructor.
      *
      * @param string $id Alias identifier
-     * @param boolean $public If this alias is public
+     * @param Boolean $public If this alias is public
      */
     public function __construct($id, $public = true)
     {
@@ -31,7 +31,7 @@ class Alias
     /**
      * Checks if this DI Alias should be public or not.
      *
-     * @return boolean
+     * @return Boolean
      */
     public function isPublic()
     {
@@ -41,7 +41,7 @@ class Alias
     /**
      * Sets if this Alias is public.
      *
-     * @param boolean $boolean If this Alias should be public
+     * @param Boolean $boolean If this Alias should be public
      */
     public function setPublic($boolean)
     {

+ 1 - 1
src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php

@@ -36,7 +36,7 @@ class AnalyzeServiceReferencesPass implements RepeatablePassInterface
     /**
      * Constructor.
      *
-     * @param boolean $onlyConstructorArguments Sets this Service Reference pass to ignore method calls
+     * @param Boolean $onlyConstructorArguments Sets this Service Reference pass to ignore method calls
      */
     public function __construct($onlyConstructorArguments = false)
     {

+ 1 - 1
src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php

@@ -106,7 +106,7 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface
      * @param ContainerBuilder $container
      * @param string           $id
      * @param Definition       $definition
-     * @return boolean If the definition is inlineable
+     * @return Boolean If the definition is inlineable
      */
     private function isInlinableDefinition(ContainerBuilder $container, $id, Definition $definition)
     {

+ 1 - 1
src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php

@@ -69,7 +69,7 @@ class ResolveInvalidReferencesPass implements CompilerPassInterface
      * Processes arguments to determine invalid references.
      *
      * @param array $arguments An array of Reference objects
-     * @param boolean $inMethodCall
+     * @param Boolean $inMethodCall
      */
     private function processArguments(array $arguments, $inMethodCall = false)
     {

+ 2 - 2
src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php

@@ -65,7 +65,7 @@ class ServiceReferenceGraphNode
     /**
      * Checks if the value of this node is an Alias.
      *
-     * @return boolean True if the value is an Alias instance
+     * @return Boolean True if the value is an Alias instance
      */
     public function isAlias()
     {
@@ -75,7 +75,7 @@ class ServiceReferenceGraphNode
     /**
      * Checks if the value of this node is a Definition.
      *
-     * @return boolean True if the value is a Definition instance
+     * @return Boolean True if the value is a Definition instance
      */
     public function isDefinition()
     {

+ 1 - 1
src/Symfony/Component/DependencyInjection/ContainerBuilder.php

@@ -83,7 +83,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
      * Checks if we have an extension.
      *
      * @param string $name The name of the extension
-     * @return boolean If the extension exists
+     * @return Boolean If the extension exists
      */
     public function hasExtension($name)
     {

+ 1 - 1
src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php

@@ -123,7 +123,7 @@ class GraphvizDumper extends Dumper
      *
      * @param string $id The service id used to find edges
      * @param array $arguments An array of arguments
-     * @param boolean $required
+     * @param Boolean $required
      * @param string $name
      * @return array An array of edges
      */

+ 3 - 3
src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

@@ -330,7 +330,7 @@ class PhpDumper extends Dumper
      *
      * @param string $id
      * @param Definition $definition
-     * @return boolean
+     * @return Boolean
      */
     private function isSimpleInstance($id, $definition)
     {
@@ -913,7 +913,7 @@ EOF;
      *
      * @param string $id
      * @param array $arguments
-     * @return boolean
+     * @return Boolean
      */
     private function hasReference($id, array $arguments)
     {
@@ -936,7 +936,7 @@ EOF;
      * Dumps values.
      *
      * @param array $value
-     * @param boolean $interpolate
+     * @param Boolean $interpolate
      * @return string
      */
     private function dumpValue($value, $interpolate = true)

+ 1 - 1
src/Symfony/Component/DependencyInjection/Reference.php

@@ -61,7 +61,7 @@ class Reference
     /**
      * Returns true when this Reference is strict
      *
-     * @return boolean
+     * @return Boolean
      */
     public function isStrict()
     {

+ 1 - 1
src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php

@@ -16,7 +16,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException;
 use Symfony\Component\Form\Exception\UnexpectedTypeException;
 
 /**
- * Transforms between a boolean and a string.
+ * Transforms between a Boolean and a string.
  *
  * @author Bernhard Schussek <bernhard.schussek@symfony.com>
  * @author Florian Eckerstorfer <florian@eckerstorfer.org>

+ 1 - 1
src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php

@@ -37,7 +37,7 @@ class ResizeFormListener implements EventSubscriberInterface
     private $type;
 
     /**
-     * @var bool
+     * @var Boolean
      */
     private $resizeOnBind;
 

+ 1 - 1
src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php

@@ -28,7 +28,7 @@ class CheckboxType extends AbstractType
     public function buildView(FormView $view, FormInterface $form)
     {
         $view->set('value', $form->getAttribute('value'));
-        $view->set('checked', (bool)$form->getData());
+        $view->set('checked', (Boolean) $form->getData());
     }
 
     public function getDefaultOptions(array $options)

+ 1 - 1
src/Symfony/Component/Form/Extension/Core/Type/RadioType.php

@@ -28,7 +28,7 @@ class RadioType extends AbstractType
     public function buildView(FormView $view, FormInterface $form)
     {
         $view->set('value', $form->getAttribute('value'));
-        $view->set('checked', (bool)$form->getData());
+        $view->set('checked', (Boolean) $form->getData());
 
         if ($view->hasParent()) {
             $view->set('name', $view->getParent()->get('name'));

+ 1 - 1
src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php

@@ -44,7 +44,7 @@ interface CsrfProviderInterface
      *
      * @param  string $pageId  The page ID used when generating the CSRF token
      * @param  string $token   The token supplied by the browser
-     * @return boolean         Whether the token supplied by the browser is
+     * @return Boolean         Whether the token supplied by the browser is
      *                         correct
      */
     public function isCsrfTokenValid($pageId, $token);

+ 1 - 1
src/Symfony/Component/Form/FormInterface.php

@@ -104,7 +104,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
     /**
      * Returns whether the form is empty
      *
-     * @return boolean
+     * @return Boolean
      */
     function isEmpty();
 

+ 13 - 91
src/Symfony/Component/HttpFoundation/File/File.php

@@ -440,13 +440,6 @@ class File
         'x-world/x-vrml' => 'wrl',
     );
 
-    /**
-     * Stores the absolute path to the document root directory.
-     *
-     * @var string
-     */
-    static protected $documentRoot;
-
     /**
      * The absolute path to the file without dots.
      *
@@ -454,30 +447,6 @@ class File
      */
     protected $path;
 
-    /**
-     * Sets the path to the document root directory.
-     *
-     * @param string $documentRoot
-     */
-    static public function setDocumentRoot($documentRoot)
-    {
-        if (!is_dir($documentRoot)) {
-            throw new \LogicException($documentRoot . ' is not a directory.');
-        }
-
-        self::$documentRoot = realpath($documentRoot);
-    }
-
-    /**
-     * Returns the path to the document root directory.
-     *
-     * @return string
-     */
-    static public function getDocumentRoot()
-    {
-        return self::$documentRoot;
-    }
-
     /**
      * Constructs a new file from the given path.
      *
@@ -491,7 +460,7 @@ class File
             throw new FileNotFoundException($path);
         }
 
-        $this->path = $path;
+        $this->path = realpath($path);
     }
 
     /**
@@ -501,7 +470,7 @@ class File
      */
     public function __toString()
     {
-        return null === $this->path ? '' : $this->path;
+        return (string) $this->path;
     }
 
     /**
@@ -522,7 +491,7 @@ class File
     public function getExtension()
     {
         if ($ext = pathinfo($this->getName(), PATHINFO_EXTENSION)) {
-            return '.' . $ext;
+            return '.'.$ext;
         }
 
         return '';
@@ -531,19 +500,19 @@ class File
     /**
      * Returns the extension based on the mime type (with dot).
      *
-     * If the mime type is unknown, the actual extension is returned instead.
+     * If the mime type is unknown, returns null.
      *
-     * @return string
+     * @return string|null The guessed extension or null if it cannot be guessed
      */
-    public function getDefaultExtension()
+    public function guessExtension()
     {
         $type = $this->getMimeType();
 
         if (isset(self::$defaultExtensions[$type])) {
-            return '.' . self::$defaultExtensions[$type];
+            return '.'.self::$defaultExtensions[$type];
         }
 
-        return $this->getExtension();
+        return null;
     }
 
     /**
@@ -566,26 +535,6 @@ class File
         return $this->path;
     }
 
-    /**
-     * Returns the path relative to the document root.
-     *
-     * You can set the document root using the static method setDocumentRoot().
-     * If the file is outside of the document root, this method returns an
-     * empty string.
-     *
-     * @return string The relative file path
-     */
-    public function getWebPath()
-    {
-        $root = self::$documentRoot;
-
-        if (false === strpos($this->path, $root)) {
-            return '';
-        }
-
-        return str_replace(array($root, DIRECTORY_SEPARATOR), array('', '/'), $this->path);
-    }
-
     /**
      * Returns the mime type of the file.
      *
@@ -617,26 +566,6 @@ class File
         return $size;
     }
 
-    /**
-     * Moves the file to a new directory and gives it a new filename
-     *
-     * @param string $directory The new directory
-     * @param string $filename  The new file name
-     *
-     * @throws FileException When the file could not be moved
-     */
-    protected function doMove($directory, $filename)
-    {
-        $newPath = $directory . DIRECTORY_SEPARATOR . $filename;
-
-        if (!@rename($this->getPath(), $newPath)) {
-            $error = error_get_last();
-            throw new FileException(sprintf('Could not move file %s to %s (%s)', $this->getPath(), $newPath, strip_tags($error['message'])));
-        }
-
-        $this->path = realpath($newPath);
-    }
-
     /**
      * Moves the file to a new location.
      *
@@ -645,20 +574,13 @@ class File
      */
     public function move($directory, $name = null)
     {
-        $this->doMove($directory, $this->getName());
+        $newPath = $directory.DIRECTORY_SEPARATOR.(null === $name ? $this->getName() : $name);
 
-        if (null !== $name) {
-            $this->rename($name);
+        if (!@rename($this->getPath(), $newPath)) {
+            $error = error_get_last();
+            throw new FileException(sprintf('Could not move file %s to %s (%s)', $this->getPath(), $newPath, strip_tags($error['message'])));
         }
-    }
 
-    /**
-     * Renames the file.
-     *
-     * @param string $name The new file name
-     */
-    public function rename($name)
-    {
-        $this->doMove($this->getDirectory(), $name);
+        $this->path = realpath($newPath);
     }
 }

+ 31 - 57
src/Symfony/Component/HttpFoundation/File/UploadedFile.php

@@ -19,6 +19,7 @@ use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
  *
  * @author Bernhard Schussek <bernhard.schussek@symfony.com>
  * @author Florian Eckerstorfer <florian@eckerstorfer.org>
+ * @author Fabien Potencier <fabien@symfony.com>
  */
 class UploadedFile extends File
 {
@@ -105,13 +106,33 @@ class UploadedFile extends File
     }
 
     /**
-     * Returns the absolute file name without dots.
+     * @inheritDoc
+     */
+    public function getExtension()
+    {
+        if ($this->moved) {
+            return parent::getExtension();
+        }
+
+        if ($ext = pathinfo($this->getOriginalName(), PATHINFO_EXTENSION)) {
+            return '.'.$ext;
+        }
+
+        return '';
+    }
+
+    /**
+     * Gets the original uploaded name.
      *
-     * @return string The file path
+     * Warning: This name is not safe as it can have been manipulated by the end-user.
+     * Moreover, it can contain characters that are not allowed in file names.
+     * Never use it in a path.
+     *
+     * @return string
      */
-    public function getName()
+    public function getOriginalName()
     {
-        return $this->moved ? parent::getName() : $this->originalName;
+        return $this->originalName;
     }
 
     /**
@@ -137,70 +158,23 @@ class UploadedFile extends File
         return $this->error === UPLOAD_ERR_OK;
     }
 
-    /**
-     * Returns true if the size of the uploaded file exceeds the
-     * upload_max_filesize directive in php.ini
-     *
-     * @return Boolean
-     */
-    protected function isIniSizeExceeded()
-    {
-        return $this->error === UPLOAD_ERR_INI_SIZE;
-    }
-
-    /**
-     * Returns true if the size of the uploaded file exceeds the
-     * MAX_FILE_SIZE directive specified in the HTML form
-     *
-     * @return Boolean
-     */
-    protected function isFormSizeExceeded()
-    {
-        return $this->error === UPLOAD_ERR_FORM_SIZE;
-    }
-
-    /**
-     * Returns true if the file was completely uploaded
-     *
-     * @return Boolean
-     */
-    protected function isUploadComplete()
-    {
-        return $this->error !== UPLOAD_ERR_PARTIAL;
-    }
-
     /**
      * @inheritDoc
      */
-    protected function doMove($directory, $filename)
+    public function move($directory, $name = null)
     {
         if ($this->moved) {
-            return parent::doMove($directory, $filename);
+            return parent::doMove($directory, $name);
         }
 
-        $newPath = $directory . DIRECTORY_SEPARATOR . $filename;
+        $newPath = $directory.DIRECTORY_SEPARATOR.(null === $name ? $this->getName() : $name);
 
-        if (!move_uploaded_file($this->getPath(), $newPath)) {
-            throw new FileException(sprintf('Could not move file %s to %s', $this->getPath(), $newPath));
+        if (!@move_uploaded_file($this->getPath(), $newPath)) {
+            $error = error_get_last();
+            throw new FileException(sprintf('Could not move file %s to %s (%s)', $this->getPath(), $newPath, strip_tags($error['message'])));
         }
 
         $this->moved = true;
         $this->path = realpath($newPath);
     }
-
-    /**
-     * @inheritDoc
-     */
-    public function move($directory, $name = null)
-    {
-        if ($this->moved) {
-            return parent::move($directory, $name);
-        }
-
-        $this->doMove($directory, $this->originalName);
-
-        if (null !== $name) {
-            $this->rename($name);
-        }
-    }
 }

+ 2 - 1
src/Symfony/Component/HttpFoundation/FileBag.php

@@ -133,7 +133,8 @@ class FileBag extends ParameterBag
         foreach (array_keys($data['name']) as $key) {
             $files[$key] = $this->fixPhpFilesArray(array(
                 'error'    => $data['error'][$key],
-                'name'     => $data['name'][$key], 'type' => $data['type'][$key],
+                'name'     => $data['name'][$key], 
+                'type'     => $data['type'][$key],
                 'tmp_name' => $data['tmp_name'][$key],
                 'size'     => $data['size'][$key]
             ));

+ 0 - 1
src/Symfony/Component/HttpFoundation/Request.php

@@ -12,7 +12,6 @@
 namespace Symfony\Component\HttpFoundation;
 
 use Symfony\Component\HttpFoundation\SessionStorage\NativeSessionStorage;
-use Symfony\Component\HttpFoundation\File\UploadedFile;
 
 /**
  * Request represents an HTTP request.

+ 2 - 2
src/Symfony/Component/Locale/Stub/DateFormat/FullTransformer.php

@@ -188,7 +188,7 @@ class FullTransformer
      * Check if the first char of a string is a single quote
      *
      * @param  string  $quoteMatch  The string to check
-     * @return bool                 true if matches, false otherwise
+     * @return Boolean              true if matches, false otherwise
      */
     public function isQuoteMatch($quoteMatch)
     {
@@ -257,7 +257,7 @@ class FullTransformer
      *
      * @param  DateTime $dateTime The DateTime object to be used to calculate the timestamp
      * @param  array    $options  An array with the matched values to be used to calculate the timestamp
-     * @return bool|int           The calculated timestamp or false if matched date is invalid
+     * @return Boolean|int        The calculated timestamp or false if matched date is invalid
      */
     protected function calculateUnixTimestamp(\DateTime $dateTime, array $options)
     {

+ 8 - 8
src/Symfony/Component/Locale/Stub/StubCollator.php

@@ -98,7 +98,7 @@ class StubCollator
      *                           StubCollator::SORT_REGULAR - compare items normally (don't change types)
      *                           StubCollator::SORT_NUMERIC - compare items numerically
      *                           StubCollator::SORT_STRING - compare items as strings
-     * @return bool              True on success or false on failure
+     * @return Boolean           True on success or false on failure
      */
     public function asort(&$array, $sortFlag = self::SORT_REGULAR)
     {
@@ -118,7 +118,7 @@ class StubCollator
      *
      * @param  string  $str1   The first string to compare
      * @param  string  $str2   The second string to compare
-     * @return bool|int        Return the comparison result or false on failure:
+     * @return Boolean|int     Return the comparison result or false on failure:
      *                         1 if $str1 is greater than $str2
      *                         0 if $str1 is equal than $str2
      *                         -1 if $str1 is less than $str2
@@ -134,7 +134,7 @@ class StubCollator
      * Get a value of an integer collator attribute
      *
      * @param  int   $attr   An attribute specifier, one of the attribute constants
-     * @return bool|int      The attribute value on success or false on error
+     * @return Boolean|int   The attribute value on success or false on error
      * @see    http://www.php.net/manual/en/collator.getattribute.php
      * @throws MethodNotImplementedException
      */
@@ -190,7 +190,7 @@ class StubCollator
     /**
      * Get current collator's strenght
      *
-     * @return bool|int   The current collator's strenght or false on failure
+     * @return Boolean|int   The current collator's strenght or false on failure
      * @see    http://www.php.net/manual/en/collator.getstrength.php
      * @throws MethodNotImplementedException
      */
@@ -204,7 +204,7 @@ class StubCollator
      *
      * @param  int   $attr   An attribute specifier, one of the attribute constants
      * @param  int   $val    The attribute value, one of the attribute value constants
-     * @return bool          True on success or false on failure
+     * @return Boolean       True on success or false on failure
      * @see    http://www.php.net/manual/en/collator.setattribute.php
      * @throws MethodNotImplementedException
      */
@@ -223,7 +223,7 @@ class StubCollator
      *                           StubCollator::QUATERNARY
      *                           StubCollator::IDENTICAL
      *                           StubCollator::DEFAULT
-     * @return bool              True on success or false on failure
+     * @return Boolean           True on success or false on failure
      * @see    http://www.php.net/manual/en/collator.setstrength.php
      * @throws MethodNotImplementedException
      */
@@ -236,7 +236,7 @@ class StubCollator
      * Sort array using specified collator and sort keys
      *
      * @param  array   &$arr   Array of strings to sort
-     * @return bool            True on success or false on failure
+     * @return Boolean         True on success or false on failure
      * @see    http://www.php.net/manual/en/collator.sortwithsortkeys.php
      * @throws MethodNotImplementedException
      */
@@ -253,7 +253,7 @@ class StubCollator
      *                             StubCollator::SORT_REGULAR
      *                             StubCollator::SORT_NUMERIC
      *                             StubCollator::SORT_STRING
-     * @return bool                True on success or false on failure
+     * @return Boolean             True on success or false on failure
      * @see    http://www.php.net/manual/en/collator.sort.php
      * @throws MethodNotImplementedException
      */

+ 6 - 6
src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php

@@ -90,7 +90,7 @@ class StubIntlDateFormatter
     private $dateTimeZone;
 
     /**
-     * @var bool
+     * @var Boolean
      */
     private $unitializedTimeZoneId = false;
 
@@ -320,7 +320,7 @@ class StubIntlDateFormatter
      * Set the formatter's calendar
      *
      * @param  string  $calendar  The calendar to use. Default is IntlDateFormatter::GREGORIAN.
-     * @return bool               true on success or false on failure
+     * @return Boolean            true on success or false on failure
      * @see    http://www.php.net/manual/en/intldateformatter.setcalendar.php
      * @throws MethodNotImplementedException
      */
@@ -337,8 +337,8 @@ class StubIntlDateFormatter
      * patterns, parsing as much as possible to obtain a value. Extra space, unrecognized tokens, or
      * invalid values ("February 30th") are not accepted.
      *
-     * @param  bool  $lenient     Sets whether the parser is lenient or not, default is false (strict)
-     * @return bool               true on success or false on failure
+     * @param  Boolean $lenient   Sets whether the parser is lenient or not, default is false (strict)
+     * @return Boolean            true on success or false on failure
      * @see    http://www.php.net/manual/en/intldateformatter.setlenient.php
      * @throws MethodNotImplementedException
      */
@@ -351,7 +351,7 @@ class StubIntlDateFormatter
      * Set the formatter's pattern
      *
      * @param  string  $pattern   A pattern string in conformance with the ICU IntlDateFormatter documentation
-     * @return bool               true on success or false on failure
+     * @return Boolean            true on success or false on failure
      * @see    http://www.php.net/manual/en/intldateformatter.setpattern.php
      * @see    http://userguide.icu-project.org/formatparse/datetime
      */
@@ -370,7 +370,7 @@ class StubIntlDateFormatter
      * @param  string  $timeZoneId   The time zone ID string of the time zone to use.
      *                               If NULL or the empty string, the default time zone for the
      *                               runtime is used.
-     * @return bool                  true on success or false on failure
+     * @return Boolean               true on success or false on failure
      * @see    http://www.php.net/manual/en/intldateformatter.settimezoneid.php
      */
     public function setTimeZoneId($timeZoneId)

+ 2 - 2
src/Symfony/Component/Locale/Stub/StubLocale.php

@@ -369,7 +369,7 @@ class StubLocale
      *
      * @param  array   $langtag       A list of the language tags to compare to locale
      * @param  string  $locale        The locale to use as the language range when matching
-     * @param  bool    $canonicalize  If true, the arguments will be converted to canonical form before matching
+     * @param  Boolean $canonicalize  If true, the arguments will be converted to canonical form before matching
      * @param  string  $default       The locale to use if no match is found
      * @see    http://www.php.net/manual/en/locale.lookup.php
      * @throws RuntimeException       When the intl extension is not loaded
@@ -396,7 +396,7 @@ class StubLocale
      * Sets the default runtime locale
      *
      * @param  string  $locale    The locale code
-     * @return bool               true on success or false on failure
+     * @return Boolean            true on success or false on failure
      * @see    http://www.php.net/manual/en/locale.parselocale.php
      * @throws MethodNotImplementedException
      */

+ 15 - 15
src/Symfony/Component/Locale/Stub/StubNumberFormatter.php

@@ -292,7 +292,7 @@ class StubNumberFormatter
      *
      * @param  number      $value                     The value to format
      * @param  int         $type                      Type of the formatting, one of the format type constants
-     * @return bool|string                            The formatted value or false on error
+     * @return Boolean|string                         The formatted value or false on error
      * @see    http://www.php.net/manual/en/numberformatter.format.php
      * @throws RuntimeException                       If the method is called with the class $style 'CURRENCY'
      * @throws MethodArgumentNotImplementedException  If the $type is different than TYPE_DEFAULT
@@ -327,7 +327,7 @@ class StubNumberFormatter
      * Returns an attribute value
      *
      * @param  int       $attr   An attribute specifier, one of the numeric attribute constants
-     * @return bool|int          The attribute value on success or false on error
+     * @return Boolean|int       The attribute value on success or false on error
      * @see    http://www.php.net/manual/en/numberformatter.getattribute.php
      */
     public function getAttribute($attr)
@@ -372,7 +372,7 @@ class StubNumberFormatter
     /**
      * Returns the formatter's pattern
      *
-     * @return bool|string        The pattern string used by the formatter or false on error
+     * @return Boolean|string     The pattern string used by the formatter or false on error
      * @see    http://www.php.net/manual/en/numberformatter.getpattern.php
      * @throws MethodNotImplementedException
      */
@@ -385,7 +385,7 @@ class StubNumberFormatter
      * Returns a formatter symbol value
      *
      * @param  int           $attr   A symbol specifier, one of the format symbol constants
-     * @return bool|string           The symbol value or false on error
+     * @return Boolean|string        The symbol value or false on error
      * @see    http://www.php.net/manual/en/numberformatter.getsymbol.php
      * @throws MethodNotImplementedException
      */
@@ -398,7 +398,7 @@ class StubNumberFormatter
      * Returns a formatter text attribute value
      *
      * @param  int           $attr   An attribute specifier, one of the text attribute constants
-     * @return bool|string           The attribute value or false on error
+     * @return Boolean|string        The attribute value or false on error
      * @see    http://www.php.net/manual/en/numberformatter.gettextattribute.php
      * @throws MethodNotImplementedException
      */
@@ -413,7 +413,7 @@ class StubNumberFormatter
      * @param  string       $value      The value to parse
      * @param  string       $currency   Parameter to receive the currency name (reference)
      * @param  int          $position   Offset to begin the parsing on return this value will hold the offset at which the parsing ended
-     * @return bool|string              The parsed numeric value of false on error
+     * @return Boolean|string           The parsed numeric value of false on error
      * @see    http://www.php.net/manual/en/numberformatter.parsecurrency.php
      * @throws MethodNotImplementedException
      */
@@ -428,7 +428,7 @@ class StubNumberFormatter
      * @param  string       $value                          The value to parse
      * @param  string       $type                           Type of the formatting, one of the format type constants. NumberFormatter::TYPE_DOUBLE by default
      * @param  int          $position                       Offset to begin the parsing on return this value will hold the offset at which the parsing ended
-     * @return bool|string                                  The parsed value of false on error
+     * @return Boolean|string                               The parsed value of false on error
      * @see    http://www.php.net/manual/en/numberformatter.parse.php
      * @throws MethodArgumentValueNotImplementedException   When $type equals to TYPE_INT64, behavior not implemented
      * @throws MethodArgumentNotImplementedException        When $position different than null, behavior not implemented
@@ -468,7 +468,7 @@ class StubNumberFormatter
      *
      * @param  int   $attr                                 An attribute specifier, one of the numeric attribute constants
      * @param  int   $value                                The attribute value
-     * @return bool                                        true on success or false on failure
+     * @return Boolean                                     true on success or false on failure
      * @see    http://www.php.net/manual/en/numberformatter.setattribute.php
      * @throws MethodArgumentValueNotImplementedException  When the $attr is not supported
      * @throws MethodArgumentValueNotImplementedException  When the $value is not supported
@@ -510,7 +510,7 @@ class StubNumberFormatter
      * Set the formatter's pattern
      *
      * @param  string  $pattern   A pattern string in conformance with the ICU DecimalFormat documentation
-     * @return bool               true on success or false on failure
+     * @return Boolean            true on success or false on failure
      * @see    http://www.php.net/manual/en/numberformatter.setpattern.php
      * @see    http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
      * @throws MethodNotImplementedException
@@ -525,7 +525,7 @@ class StubNumberFormatter
      *
      * @param  int      $attr    A symbol specifier, one of the format symbol constants
      * @param  string   $value   The value for the symbol
-     * @return bool              true on success or false on failure
+     * @return Boolean           true on success or false on failure
      * @see    http://www.php.net/manual/en/numberformatter.setsymbol.php
      * @throws MethodNotImplementedException
      */
@@ -539,7 +539,7 @@ class StubNumberFormatter
      *
      * @param  int   $attr       An attribute specifier, one of the text attribute constants
      * @param  int   $value      The attribute value
-     * @return bool              true on success or false on failure
+     * @return Boolean           true on success or false on failure
      * @see    http://www.php.net/manual/en/numberformatter.settextattribute.php
      * @throws MethodNotImplementedException
      */
@@ -674,7 +674,7 @@ class StubNumberFormatter
      * Check if the attribute is initialized (value set by client code).
      *
      * @param  string  $attr   The attribute name
-     * @return bool            true if the value was set by cliente, false otherwise
+     * @return Boolean         true if the value was set by cliente, false otherwise
      */
     private function isInitializedAttribute($attr)
     {
@@ -719,7 +719,7 @@ class StubNumberFormatter
      * Check if the rounding mode is invalid.
      *
      * @param  int    $value  The rounding mode value to check
-     * @return bool           true if the rounding mode is invalid, false otherwise
+     * @return Boolean        true if the rounding mode is invalid, false otherwise
      */
     private function isInvalidRoundingMode($value)
     {
@@ -732,13 +732,13 @@ class StubNumberFormatter
 
     /**
      * Returns the normalized value for the GROUPING_USED attribute. Any value that can be converted to int will be
-     * cast to boolean and then to int again. This way, negative values are converted to 1 and string values to 0.
+     * cast to Boolean and then to int again. This way, negative values are converted to 1 and string values to 0.
      *
      * @param  mixed  $value   The value to be normalized
      * @return int             The normalized value for the attribute (0 or 1)
      */
     private function normalizeGroupingUsedValue($value) {
-        return (int) (bool) (int) $value;
+        return (int) (Boolean) (int) $value;
     }
 
     /**

+ 1 - 1
src/Symfony/Component/Security/Core/SecurityContext.php

@@ -53,7 +53,7 @@ class SecurityContext implements SecurityContextInterface
      * @throws AuthenticationCredentialsNotFoundException when the security context has no authentication token.
      * @param mixed $attributes
      * @param mixed|null $object
-     * @return boolean
+     * @return Boolean
      */
     public final function isGranted($attributes, $object = null)
     {

+ 1 - 1
src/Symfony/Component/Security/Core/SecurityContextInterface.php

@@ -35,7 +35,7 @@ interface SecurityContextInterface
      *
      * @param array $attributes
      * @param mixed $object
-     * @return boolean
+     * @return Boolean
      */
     function isGranted($attributes, $object = null);
 }

+ 1 - 1
src/Symfony/Component/Serializer/Encoder/XmlEncoder.php

@@ -201,7 +201,7 @@ class XmlEncoder extends AbstractEncoder implements DecoderInterface
      *
      * @param DOMNode $parentNode
      * @param array|object $data data
-     * @return bool
+     * @return Boolean
      */
     private function buildXml($parentNode, $data)
     {

+ 1 - 1
src/Symfony/Component/Validator/ValidatorFactory.php

@@ -87,7 +87,7 @@ class ValidatorFactory implements ValidatorContextInterface
      * @param  array $mappingFiles          A list of XML or YAML file names
      *                                      where mapping information can be
      *                                      found. Can be empty.
-     * @param  boolean $annotations         Whether to use annotations for
+     * @param  Boolean $annotations         Whether to use annotations for
      *                                      retrieving mapping information
      * @param  array $annotationNamespaces  The annotation namespaces used
      *                                      for finding the annotation classes.

+ 1 - 1
tests/Symfony/Tests/Component/Form/Extension/Core/Type/ChoiceTypeTest.php

@@ -227,7 +227,7 @@ class ChoiceTypeTest extends TypeTestCase
     }
 
     /*
-     * We need this functionality to create choice fields for boolean types,
+     * We need this functionality to create choice fields for Boolean types,
      * e.g. false => 'No', true => 'Yes'
      */
     public function testSetDataSingleNonExpandedAcceptsBoolean()

+ 0 - 1
tests/Symfony/Tests/Component/Form/Extension/Core/Type/FormTypeTest.php

@@ -23,7 +23,6 @@ use Symfony\Component\Form\HiddenField;
 use Symfony\Component\Form\Util\PropertyPath;
 use Symfony\Component\Form\CallbackTransformer;
 use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\File\UploadedFile;
 use Symfony\Component\Validator\ConstraintViolation;
 use Symfony\Component\Validator\ConstraintViolationList;
 use Symfony\Component\Validator\ExecutionView;

+ 4 - 45
tests/Symfony/Tests/Component/HttpFoundation/File/FileTest.php

@@ -33,28 +33,6 @@ class FileTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(__DIR__.'/Fixtures/test.gif', (string) $this->file);
     }
 
-    public function testGetWebPathReturnsPathRelativeToDocumentRoot()
-    {
-        File::setDocumentRoot(__DIR__);
-
-        $this->assertEquals(__DIR__, File::getDocumentRoot());
-        $this->assertEquals('/Fixtures/test.gif', $this->file->getWebPath());
-    }
-
-    public function testGetWebPathReturnsEmptyPathIfOutsideDocumentRoot()
-    {
-        File::setDocumentRoot(__DIR__.'/Fixtures/directory');
-
-        $this->assertEquals('', $this->file->getWebPath());
-    }
-
-    public function testSetDocumentRootThrowsLogicExceptionWhenNotExists()
-    {
-        $this->setExpectedException('LogicException');
-
-        File::setDocumentRoot(__DIR__.'/Fixtures/not_here');
-    }
-
     public function testGetNameReturnsNameWithExtension()
     {
         $this->assertEquals('test.gif', $this->file->getName());
@@ -85,21 +63,21 @@ class FileTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('image/gif', $this->file->getMimeType());
     }
 
-    public function testGetDefaultExtensionWithoutGuesser()
+    public function testGuessExtensionWithoutGuesser()
     {
         $file = new File(__DIR__.'/Fixtures/directory/.empty');
 
-        $this->assertEquals('.empty', $file->getDefaultExtension());
+        $this->assertEquals(null, $file->guessExtension());
     }
 
-    public function testGetDefaultExtensionIsBasedOnMimeType()
+    public function testGuessExtensionIsBasedOnMimeType()
     {
         $file = new File(__DIR__.'/Fixtures/test');
         $guesser = $this->createMockGuesser($file->getPath(), 'image/gif');
 
         MimeTypeGuesser::getInstance()->register($guesser);
 
-        $this->assertEquals('.gif', $file->getDefaultExtension());
+        $this->assertEquals('.gif', $file->guessExtension());
     }
 
     public function testConstructWhenFileNotExists()
@@ -189,25 +167,6 @@ class FileTest extends \PHPUnit_Framework_TestCase
         @unlink($targetPath);
     }
 
-    public function testRename()
-    {
-        $path = __DIR__.'/Fixtures/test.copy.gif';
-        $targetPath = realpath(__DIR__.'/Fixtures').DIRECTORY_SEPARATOR.'test.target.gif';
-        @unlink($path);
-        @unlink($targetPath);
-        copy(realpath(__DIR__.'/Fixtures/test.gif'), $path);
-
-        $file = new File($path);
-        $file->rename('test.target.gif');
-
-        $this->assertTrue(file_exists($targetPath));
-        $this->assertFalse(file_exists($path));
-        $this->assertEquals($targetPath, $file->getPath());
-
-        @unlink($path);
-        @unlink($targetPath);
-    }
-
     protected function createMockGuesser($path, $mimeType)
     {
         $guesser = $this->getMock('Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface');

+ 1 - 1
tests/Symfony/Tests/Component/HttpFoundation/File/UploadedFileTest.php

@@ -77,6 +77,6 @@ class UploadedFileTest extends \PHPUnit_Framework_TestCase
             null
         );
 
-        $this->assertEquals('original.gif', $file->getName());
+        $this->assertEquals('test.gif', $file->getName());
     }
 }

+ 0 - 1
tests/Symfony/Tests/Component/HttpFoundation/RequestTest.php

@@ -12,7 +12,6 @@
 namespace Symfony\Tests\Component\HttpFoundation;
 
 use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\File\UploadedFile;
 
 class RequestTest extends \PHPUnit_Framework_TestCase
 {

+ 1 - 1
tests/Symfony/Tests/Component/HttpKernel/KernelTest.php

@@ -737,7 +737,7 @@ class KernelForTest extends Kernel
 
     public function setIsBooted($value)
     {
-        $this->booted = (bool) $value;
+        $this->booted = (Boolean) $value;
     }
 }
 

+ 1 - 1
tests/Symfony/Tests/Component/Yaml/Fixtures/YtsTypeTransfers.yml

@@ -157,7 +157,7 @@ php: |
 --- 
 test: Boolean 
 brief: > 
-    You can use 'true' and 'false' for boolean values. 
+    You can use 'true' and 'false' for Boolean values.
 yaml: | 
     Is Gus a Liar?: true
     Do I rely on Gus for Sustenance?: false