diff --git a/src/Symfony/Component/Form/Resources/translations/validators.tl.xlf b/src/Symfony/Component/Form/Resources/translations/validators.tl.xlf new file mode 100644 index 0000000000..02def0bf31 --- /dev/null +++ b/src/Symfony/Component/Form/Resources/translations/validators.tl.xlf @@ -0,0 +1,19 @@ + + + + + + This form should not contain extra fields. + Ang pormang itong ay hindi dapat magkarron ng dagdag na mga patlang. + + + The uploaded file was too large. Please try to upload a smaller file. + Ang ini-upload na file ay masyadong malaki. Pakiulit muling mag-upload ng mas maliit na file. + + + The CSRF token is invalid. Please try to resubmit the form. + Hindi balido ang CSRF token. Maagpasa muli ng isang pang porma. + + + + diff --git a/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php index 9d843667a6..25aa385c61 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php @@ -99,9 +99,13 @@ class SimpleFormAuthenticationListener extends AbstractAuthenticationListener } } - $requestBag = $this->options['post_only'] ? $request->request : $request; - $username = ParameterBagUtils::getParameterBagValue($requestBag, $this->options['username_parameter']); - $password = ParameterBagUtils::getParameterBagValue($requestBag, $this->options['password_parameter']); + if ($this->options['post_only']) { + $username = ParameterBagUtils::getParameterBagValue($request->request, $this->options['username_parameter']); + $password = ParameterBagUtils::getParameterBagValue($request->request, $this->options['password_parameter']); + } else { + $username = ParameterBagUtils::getRequestParameterValue($request, $this->options['username_parameter']); + $password = ParameterBagUtils::getRequestParameterValue($request, $this->options['password_parameter']); + } if (!\is_string($username) || (\is_object($username) && !\method_exists($username, '__toString'))) { throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], \gettype($username))); diff --git a/src/Symfony/Component/Serializer/Annotation/Groups.php b/src/Symfony/Component/Serializer/Annotation/Groups.php index 432f7f9efc..7a9b0bd2c1 100644 --- a/src/Symfony/Component/Serializer/Annotation/Groups.php +++ b/src/Symfony/Component/Serializer/Annotation/Groups.php @@ -34,13 +34,13 @@ class Groups public function __construct(array $data) { if (!isset($data['value']) || !$data['value']) { - throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" cannot be empty.', get_class($this))); + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" cannot be empty.', \get_class($this))); } $value = (array) $data['value']; foreach ($value as $group) { - if (!is_string($group)) { - throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of strings.', get_class($this))); + if (!\is_string($group)) { + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of strings.', \get_class($this))); } } diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 951b38aa55..96578c6bc7 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -184,7 +184,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec */ final protected function appendXMLString(\DOMNode $node, $val) { - if (strlen($val) > 0) { + if (\strlen($val) > 0) { $frag = $this->dom->createDocumentFragment(); $frag->appendXML($val); $node->appendChild($frag); @@ -265,17 +265,17 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec $value = $this->parseXmlValue($node, $context); - if (!count($data)) { + if (!\count($data)) { return $value; } - if (!is_array($value)) { + if (!\is_array($value)) { $data['#'] = $value; return $data; } - if (1 === count($value) && key($value)) { + if (1 === \count($value) && key($value)) { $data[key($value)] = current($value); return $data; @@ -332,7 +332,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec return $node->nodeValue; } - if (1 === $node->childNodes->length && in_array($node->firstChild->nodeType, array(XML_TEXT_NODE, XML_CDATA_SECTION_NODE))) { + if (1 === $node->childNodes->length && \in_array($node->firstChild->nodeType, array(XML_TEXT_NODE, XML_CDATA_SECTION_NODE))) { return $node->firstChild->nodeValue; } @@ -357,7 +357,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec } foreach ($value as $key => $val) { - if (is_array($val) && 1 === count($val)) { + if (\is_array($val) && 1 === \count($val)) { $value[$key] = current($val); } } @@ -380,7 +380,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec { $append = true; - if (is_array($data) || ($data instanceof \Traversable && !$this->serializer->supportsNormalization($data, $this->format))) { + if (\is_array($data) || ($data instanceof \Traversable && !$this->serializer->supportsNormalization($data, $this->format))) { foreach ($data as $key => $data) { //Ah this is the magic @ attribute types. if (0 === strpos($key, '@') && $this->isElementNameValid($attributeName = substr($key, 1))) { @@ -390,7 +390,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec $parentNode->setAttribute($attributeName, $data); } elseif ('#' === $key) { $append = $this->selectNodeType($parentNode, $data); - } elseif (is_array($data) && false === is_numeric($key)) { + } elseif (\is_array($data) && false === is_numeric($key)) { // Is this array fully numeric keys? if (ctype_digit(implode('', array_keys($data)))) { /* @@ -414,7 +414,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec return $append; } - if (is_object($data)) { + if (\is_object($data)) { $data = $this->serializer->normalize($data, $this->format, $this->context); if (null !== $data && !is_scalar($data)) { return $this->buildXml($parentNode, $data, $xmlRootNodeName); @@ -483,22 +483,22 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec */ private function selectNodeType(\DOMNode $node, $val) { - if (is_array($val)) { + if (\is_array($val)) { return $this->buildXml($node, $val); } elseif ($val instanceof \SimpleXMLElement) { $child = $this->dom->importNode(dom_import_simplexml($val), true); $node->appendChild($child); } elseif ($val instanceof \Traversable) { $this->buildXml($node, $val); - } elseif (is_object($val)) { + } elseif (\is_object($val)) { return $this->selectNodeType($node, $this->serializer->normalize($val, $this->format, $this->context)); } elseif (is_numeric($val)) { return $this->appendText($node, (string) $val); - } elseif (is_string($val) && $this->needsCdataWrapping($val)) { + } elseif (\is_string($val) && $this->needsCdataWrapping($val)) { return $this->appendCData($node, $val); - } elseif (is_string($val)) { + } elseif (\is_string($val)) { return $this->appendText($node, $val); - } elseif (is_bool($val)) { + } elseif (\is_bool($val)) { return $this->appendText($node, (int) $val); } elseif ($val instanceof \DOMNode) { $child = $this->dom->importNode($val, true); diff --git a/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php b/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php index 5888234a4c..9ad6e30810 100644 --- a/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php +++ b/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php @@ -64,7 +64,7 @@ class AttributeMetadata implements AttributeMetadataInterface */ public function addGroup($group) { - if (!in_array($group, $this->groups)) { + if (!\in_array($group, $this->groups)) { $this->groups[] = $group; } } diff --git a/src/Symfony/Component/Serializer/Mapping/Loader/LoaderChain.php b/src/Symfony/Component/Serializer/Mapping/Loader/LoaderChain.php index ef7e19cdea..1890a9d84c 100644 --- a/src/Symfony/Component/Serializer/Mapping/Loader/LoaderChain.php +++ b/src/Symfony/Component/Serializer/Mapping/Loader/LoaderChain.php @@ -40,7 +40,7 @@ class LoaderChain implements LoaderInterface { foreach ($loaders as $loader) { if (!$loader instanceof LoaderInterface) { - throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface', get_class($loader))); + throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface', \get_class($loader))); } } diff --git a/src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php b/src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php index 970241d347..ca9d43e15b 100644 --- a/src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php @@ -30,7 +30,7 @@ class YamlFileLoader extends FileLoader * * @var array */ - private $classes = null; + private $classes; /** * {@inheritdoc} @@ -51,7 +51,7 @@ class YamlFileLoader extends FileLoader $yaml = $this->classes[$classMetadata->getName()]; - if (isset($yaml['attributes']) && is_array($yaml['attributes'])) { + if (isset($yaml['attributes']) && \is_array($yaml['attributes'])) { $attributesMetadata = $classMetadata->getAttributesMetadata(); foreach ($yaml['attributes'] as $attribute => $data) { @@ -63,12 +63,12 @@ class YamlFileLoader extends FileLoader } if (isset($data['groups'])) { - if (!is_array($data['groups'])) { + if (!\is_array($data['groups'])) { throw new MappingException(sprintf('The "groups" key must be an array of strings in "%s" for the attribute "%s" of the class "%s".', $this->file, $attribute, $classMetadata->getName())); } foreach ($data['groups'] as $group) { - if (!is_string($group)) { + if (!\is_string($group)) { throw new MappingException(sprintf('Group names must be strings in "%s" for the attribute "%s" of the class "%s".', $this->file, $attribute, $classMetadata->getName())); } @@ -119,7 +119,7 @@ class YamlFileLoader extends FileLoader return array(); } - if (!is_array($classes)) { + if (!\is_array($classes)) { throw new MappingException(sprintf('The file "%s" must contain a YAML array.', $this->file)); } diff --git a/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php b/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php index 8a974865b4..9c3f318edd 100644 --- a/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php +++ b/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php @@ -36,7 +36,7 @@ class CamelCaseToSnakeCaseNameConverter implements NameConverterInterface */ public function normalize($propertyName) { - if (null === $this->attributes || in_array($propertyName, $this->attributes)) { + if (null === $this->attributes || \in_array($propertyName, $this->attributes)) { return strtolower(preg_replace('/[A-Z]/', '_\\0', lcfirst($propertyName))); } @@ -56,7 +56,7 @@ class CamelCaseToSnakeCaseNameConverter implements NameConverterInterface $camelCasedName = lcfirst($camelCasedName); } - if (null === $this->attributes || in_array($camelCasedName, $this->attributes)) { + if (null === $this->attributes || \in_array($camelCasedName, $this->attributes)) { return $camelCasedName; } diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index 3ccf48529f..74a133214f 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -119,7 +119,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N public function setCallbacks(array $callbacks) { foreach ($callbacks as $attribute => $callback) { - if (!is_callable($callback)) { + if (!\is_callable($callback)) { throw new InvalidArgumentException(sprintf( 'The given callback for attribute "%s" is not callable.', $attribute @@ -187,10 +187,10 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N protected function handleCircularReference($object) { if ($this->circularReferenceHandler) { - return call_user_func($this->circularReferenceHandler, $object); + return \call_user_func($this->circularReferenceHandler, $object); } - throw new CircularReferenceException(sprintf('A circular reference has been detected when serializing the object of class "%s" (configured limit: %d)', get_class($object), $this->circularReferenceLimit)); + throw new CircularReferenceException(sprintf('A circular reference has been detected when serializing the object of class "%s" (configured limit: %d)', \get_class($object), $this->circularReferenceLimit)); } /** @@ -209,7 +209,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N } $groups = false; - if (isset($context[static::GROUPS]) && is_array($context[static::GROUPS])) { + if (isset($context[static::GROUPS]) && \is_array($context[static::GROUPS])) { $groups = $context[static::GROUPS]; } elseif (!isset($context[static::ALLOW_EXTRA_ATTRIBUTES]) || $context[static::ALLOW_EXTRA_ATTRIBUTES]) { return false; @@ -220,7 +220,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N $name = $attributeMetadata->getName(); if ( - (false === $groups || count(array_intersect($attributeMetadata->getGroups(), $groups))) && + (false === $groups || array_intersect($attributeMetadata->getGroups(), $groups)) && $this->isAllowedAttribute($classOrObject, $name, null, $context) ) { $allowedAttributes[] = $attributesAsString ? $name : $attributeMetadata; @@ -309,10 +309,10 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N */ protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes/*, string $format = null*/) { - if (func_num_args() >= 6) { - $format = func_get_arg(5); + if (\func_num_args() >= 6) { + $format = \func_get_arg(5); } else { - if (__CLASS__ !== get_class($this)) { + if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('Method %s::%s() will have a 6th `string $format = null` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED); @@ -337,11 +337,11 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N $paramName = $constructorParameter->name; $key = $this->nameConverter ? $this->nameConverter->normalize($paramName) : $paramName; - $allowed = false === $allowedAttributes || in_array($paramName, $allowedAttributes); + $allowed = false === $allowedAttributes || \in_array($paramName, $allowedAttributes); $ignored = !$this->isAllowedAttribute($class, $paramName, $format, $context); if (method_exists($constructorParameter, 'isVariadic') && $constructorParameter->isVariadic()) { if ($allowed && !$ignored && (isset($data[$key]) || array_key_exists($key, $data))) { - if (!is_array($data[$paramName])) { + if (!\is_array($data[$paramName])) { throw new RuntimeException(sprintf('Cannot create an instance of %s from serialized data because the variadic parameter %s can only accept an array.', $class, $constructorParameter->name)); } diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php index b5dbee7d51..6eec9dd4d9 100644 --- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php @@ -80,7 +80,7 @@ class GetSetMethodNormalizer extends AbstractObjectNormalizer */ private function isGetMethod(\ReflectionMethod $method) { - $methodLength = strlen($method->name); + $methodLength = \strlen($method->name); return !$method->isStatic() && @@ -125,17 +125,17 @@ class GetSetMethodNormalizer extends AbstractObjectNormalizer $ucfirsted = ucfirst($attribute); $getter = 'get'.$ucfirsted; - if (is_callable(array($object, $getter))) { + if (\is_callable(array($object, $getter))) { return $object->$getter(); } $isser = 'is'.$ucfirsted; - if (is_callable(array($object, $isser))) { + if (\is_callable(array($object, $isser))) { return $object->$isser(); } $haser = 'has'.$ucfirsted; - if (is_callable(array($object, $haser))) { + if (\is_callable(array($object, $haser))) { return $object->$haser(); } } @@ -146,10 +146,10 @@ class GetSetMethodNormalizer extends AbstractObjectNormalizer protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = array()) { $setter = 'set'.ucfirst($attribute); - $key = get_class($object).':'.$setter; + $key = \get_class($object).':'.$setter; if (!isset(self::$setterAccessibleCache[$key])) { - self::$setterAccessibleCache[$key] = is_callable(array($object, $setter)) && !(new \ReflectionMethod($object, $setter))->isStatic(); + self::$setterAccessibleCache[$key] = \is_callable(array($object, $setter)) && !(new \ReflectionMethod($object, $setter))->isStatic(); } if (self::$setterAccessibleCache[$key]) { diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index a92eb176d9..614d6cd4a9 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -30,7 +30,7 @@ class ObjectNormalizer extends AbstractObjectNormalizer public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null) { - if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccess')) { + if (!\class_exists(PropertyAccess::class)) { throw new RuntimeException('The ObjectNormalizer class requires the "PropertyAccess" component. Install "symfony/property-access" to use it.'); } diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index 1b244177c7..1eafaa96e5 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -147,7 +147,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz return $data; } - if (is_array($data) || $data instanceof \Traversable) { + if (\is_array($data) || $data instanceof \Traversable) { $normalized = array(); foreach ($data as $key => $val) { $normalized[$key] = $this->normalize($val, $format, $context); @@ -156,12 +156,12 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz return $normalized; } - if (is_object($data)) { + if (\is_object($data)) { if (!$this->normalizers) { throw new LogicException('You must register at least one normalizer to be able to normalize objects.'); } - throw new NotNormalizableValueException(sprintf('Could not normalize object of type %s, no supporting normalizer found.', get_class($data))); + throw new NotNormalizableValueException(sprintf('Could not normalize object of type %s, no supporting normalizer found.', \get_class($data))); } throw new NotNormalizableValueException(sprintf('An unexpected value could not be normalized: %s', var_export($data, true))); @@ -190,10 +190,10 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz */ public function supportsNormalization($data, $format = null/*, array $context = array()*/) { - if (func_num_args() > 2) { - $context = func_get_arg(2); + if (\func_num_args() > 2) { + $context = \func_get_arg(2); } else { - if (__CLASS__ !== get_class($this)) { + if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('Method %s() will have a third `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); @@ -211,10 +211,10 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz */ public function supportsDenormalization($data, $type, $format = null/*, array $context = array()*/) { - if (func_num_args() > 3) { - $context = func_get_arg(3); + if (\func_num_args() > 3) { + $context = \func_get_arg(3); } else { - if (__CLASS__ !== get_class($this)) { + if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('Method %s() will have a fourth `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); @@ -285,10 +285,10 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz */ public function supportsEncoding($format/*, array $context = array()*/) { - if (func_num_args() > 1) { - $context = func_get_arg(1); + if (\func_num_args() > 1) { + $context = \func_get_arg(1); } else { - if (__CLASS__ !== get_class($this)) { + if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('Method %s() will have a second `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); @@ -306,10 +306,10 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz */ public function supportsDecoding($format/*, array $context = array()*/) { - if (func_num_args() > 1) { - $context = func_get_arg(1); + if (\func_num_args() > 1) { + $context = \func_get_arg(1); } else { - if (__CLASS__ !== get_class($this)) { + if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('Method %s() will have a second `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);