Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Felix Labrecque 2012-12-04 10:37:06 -05:00
commit 737b596cec
13 changed files with 188 additions and 45 deletions

View File

@ -7,6 +7,30 @@ in 2.0 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.0.0...v2.0.1
* 2.0.19 (2012-11-29)
* e5536f0: replaced magic strings by proper constants
* 6a3ba52: fixed the logic in Request::isSecure() (if the information comes from a source that we trust, don't check other ones)
* 67e12f3: added a way to configure the X-Forwarded-XXX header names and a way to disable trusting them
* b45873a: fixed algorithm used to determine the trusted client IP
* 254b110: removed the non-standard Client-IP HTTP header
* fc89d6b: [DependencyInjection] fixed composer.json
* ac77c5b: [Form] Updated checks for the ICU version from 4.5+ to 4.7+ due to test failures with ICU 4.6
* 29bfa13: small fix of #5984 when the container param is not set
* 64b54dc: Use better default ports in urlRedirectAction
* f2cbea3: [Security] remove escape charters from username provided by Digest DigestAuthenticationListener
* 694697d: [Security] Fixed digest authentication
* c067586: [Security] Fixed digest authentication
* 32dc31e: [SecurityBundle] Convert Http method to uppercase in the config
* b3a8efd: fixed comment. The parent ACL is not accessed in this method.
* e12bd12: [HttpFoundation] Make host & methods really case insensitive in the RequestMacther
* 15a5868: [Validator] fixed Ukrainian language code (closes #5972)
* dc80385: [Form] Fixed NumberToLocalizedStringTransformer to accept both comma and dot as decimal separator, if possible
* 9872d26: [HttpFoundation] Fix name sanitization after perfoming move
* 6f15c47: [ClassLoader] fixed unbracketed namespaces (closes #5747)
* 2d9a6fc: Use Norm Data instead of Data
* a094f7e: Add check to Store::unlock to ensure file exists
* 2.0.18 (2012-10-25)
* 20898e5: Add to DateFormats 'D M d H:i:s Y T' (closes #5830)

View File

@ -7,6 +7,47 @@ in 2.1 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.1.0...v2.1.1
* 2.1.4 (2012-12-29)
* e5536f0: replaced magic strings by proper constants
* 6a3ba52: fixed the logic in Request::isSecure() (if the information comes from a source that we trust, don't check other ones)
* 67e12f3: added a way to configure the X-Forwarded-XXX header names and a way to disable trusting them
* b45873a: fixed algorithm used to determine the trusted client IP
* 254b110: removed the non-standard Client-IP HTTP header
* 06ee53b: [Form] improve error message with a "hasser" hint for PropertyAccessDeniedException
* ac77c5b: [Form] Updated checks for the ICU version from 4.5+ to 4.7+ due to test failures with ICU 4.6
* 2fe04e1: Update src/Symfony/Component/Form/Extension/Core/Type/FileType.php
* bbeff54: Xliff with other node than source or target are ignored
* 29bfa13: small fix of #5984 when the container param is not set
* f211b19: Filesystem Component mirror symlinked directory fix
* 64b54dc: Use better default ports in urlRedirectAction
* e7401a2: Update src/Symfony/Component/DomCrawler/Tests/FormTest.php
* b0e468f: Update src/Symfony/Component/DomCrawler/Form.php
* 1daefa5: [Routing] made it compatible with older PCRE version (pre 8)
* f2cbea3: [Security] remove escape charters from username provided by Digest DigestAuthenticationListener
* 82334d2: Force loader to be null or a EntityLoaderInterface
* 694697d: [Security] Fixed digest authentication
* c067586: [Security] Fixed digest authentication
* d2920c9: Added HttpCache\Store::generateContentDigest() + changed visibility
* e12bd12: [HttpFoundation] Make host & methods really case insensitive in the RequestMacther
* c659e78: Make YamlFileLoader and XmlFileLoader file loading extensible
* 0f75586: [Form] Removed an exception that prevented valid formats from being passed, e.g. "h" for the hour, "L" for the month etc.
* 84b760b: [HttpKernel] fixed Client when using StreamedResponses (closes #5370)
* 67e697f: fixed PDO session handler for Oracle (closes #5829)
* c2a8a0b: [HttpFoundation] fixed PDO session handler for Oracle (closes #5829)
* a30383d: [Locale] removed a check that is done too early (and it is done twice anyways)
* 84635bd: [Form] allowed no type guesser to be registered
* 8377146: Adding new localized strings for farsi validation.
* e34fb41: [HttpFoundation] moved the HTTP protocol check from StreamedResponse to Response (closes #5937)
* 4909bc3: [Form] Fixed forms not to be marked invalid if their children are already marked invalid
* dc80385: [Form] Fixed NumberToLocalizedStringTransformer to accept both comma and dot as decimal separator, if possible
* 208e134: [FrameworkBundle] Router skip defaults resolution for arrays
* a0af8bf: [Form] Adapted HTML5 format in DateTimeType as response to a closed ICU ticket
* 6b42c8c: The exception message should say which field is not mapped
* 9872d26: [HttpFoundation] Fix name sanitization after perfoming move
* 2d9a6fc: Use Norm Data instead of Data
* a094f7e: Add check to Store::unlock to ensure file exists
* 2.1.3 (2012-10-30)
* 6f15c47: [ClassLoader] fixed unbracketed namespaces (closes #5747)

View File

@ -90,7 +90,7 @@ class TranslationCollectionFormListener implements EventSubscriberInterface
}
}
if(!$foundData) {
throw new UnexpectedTypeException($rootData, 'Propel i18n object');;
throw new UnexpectedTypeException($rootData, 'Propel i18n object');
}
$newTranslation = new $this->i18nClass();

View File

@ -247,7 +247,7 @@ class Command
* If this method is used, it overrides the code defined
* in the execute() method.
*
* @param \Closure $code A \Closure
* @param callable $code A callable(InputInterface $input, OutputInterface $output)
*
* @return Command The current instance
*
@ -255,8 +255,12 @@ class Command
*
* @api
*/
public function setCode(\Closure $code)
public function setCode($code)
{
if (!is_callable($code)) {
throw new \InvalidArgumentException('Invalid callable provided to Command::setCode.');
}
$this->code = $code;
return $this;

View File

@ -240,6 +240,31 @@ class CommandTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay());
}
public function testSetCodeWithNonClosureCallable()
{
$command = new \TestCommand();
$ret = $command->setCode(array($this, 'callableMethodCommand'));
$this->assertEquals($command, $ret, '->setCode() implements a fluent interface');
$tester = new CommandTester($command);
$tester->execute(array());
$this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay());
}
/**
* @expectedException InvalidArgumentException
* @expectedExceptionMessage Invalid callable provided to Command::setCode.
*/
public function testSetCodeWithNonCallable()
{
$command = new \TestCommand();
$command->setCode(array($this, 'nonExistentMethod'));
}
public function callableMethodCommand(InputInterface $input, OutputInterface $output)
{
$output->writeln('from the code...');
}
public function testAsText()
{
$command = new \TestCommand();

View File

@ -617,7 +617,7 @@ class Request
* Whether the request contains a Session which was started in one of the
* previous requests.
*
* @return boolean
* @return Boolean
*
* @api
*/
@ -630,7 +630,11 @@ class Request
/**
* Whether the request contains a Session object.
*
* @return boolean
* This method does not give any information about the state of the session object,
* like whether the session is started or not. It is just a way to check if this Request
* is associated with a Session instance.
*
* @return Boolean true when the Request contains a Session object, false otherwise
*
* @api
*/
@ -1064,7 +1068,7 @@ class Request
*/
public function getRealMethod()
{
return $this->server->get('REQUEST_METHOD', 'GET');
return strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
}
/**

View File

@ -770,6 +770,10 @@ class RequestTest extends \PHPUnit_Framework_TestCase
array('PUT'),
array('DELETE'),
array('PATCH'),
array('put'),
array('delete'),
array('patch'),
);
}
@ -778,6 +782,8 @@ class RequestTest extends \PHPUnit_Framework_TestCase
*/
public function testCreateFromGlobals($method)
{
$normalizedMethod = strtoupper($method);
$_GET['foo1'] = 'bar1';
$_POST['foo2'] = 'bar2';
$_COOKIE['foo3'] = 'bar3';
@ -796,18 +802,19 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$_SERVER['REQUEST_METHOD'] = $method;
$_SERVER['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
$request = RequestContentProxy::createFromGlobals();
$this->assertEquals($method, $request->getMethod());
$this->assertEquals($normalizedMethod, $request->getMethod());
$this->assertEquals('mycontent', $request->request->get('content'));
unset($_SERVER['REQUEST_METHOD'], $_SERVER['CONTENT_TYPE']);
$request = Request::createFromGlobals();
Request::createFromGlobals();
Request::enableHttpMethodParameterOverride();
$_POST['_method'] = $method;
$_POST['foo6'] = 'bar6';
$_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REQUEST_METHOD'] = 'PoSt';
$request = Request::createFromGlobals();
$this->assertEquals($method, $request->getMethod());
$this->assertEquals($normalizedMethod, $request->getMethod());
$this->assertEquals('POST', $request->getRealMethod());
$this->assertEquals('bar6', $request->request->get('foo6'));
unset($_POST['_method'], $_POST['foo6'], $_SERVER['REQUEST_METHOD']);

View File

@ -5,42 +5,55 @@
targetNamespace="http://symfony.com/schema/routing"
elementFormDefault="qualified">
<xsd:annotation>
<xsd:documentation><![CDATA[
Symfony XML Routing Schema, version 1.0
Authors: Fabien Potencier, Tobias Schultze
This scheme defines the elements and attributes that can be used to define
routes. A route maps an HTTP request to a set of configuration variables.
]]></xsd:documentation>
</xsd:annotation>
<xsd:element name="routes" type="routes" />
<xsd:complexType name="routes">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="import" type="import" />
<xsd:element name="route" type="route" />
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="route">
<xsd:sequence>
<xsd:element name="default" type="element" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="requirement" type="element" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="option" type="element" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:group name="configs">
<xsd:choice>
<xsd:element name="default" type="element" />
<xsd:element name="requirement" type="element" />
<xsd:element name="option" type="element" />
</xsd:choice>
</xsd:group>
<xsd:attribute name="id" type="xsd:string" />
<xsd:attribute name="pattern" type="xsd:string" />
<xsd:complexType name="route">
<xsd:group ref="configs" minOccurs="0" maxOccurs="unbounded" />
<xsd:attribute name="id" type="xsd:string" use="required" />
<xsd:attribute name="pattern" type="xsd:string" default="/" />
<xsd:attribute name="hostname-pattern" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="import">
<xsd:sequence>
<xsd:element name="default" type="element" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="requirement" type="element" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="option" type="element" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:group ref="configs" minOccurs="0" maxOccurs="unbounded" />
<xsd:attribute name="resource" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="prefix" type="xsd:string" />
<xsd:attribute name="class" type="xsd:string" />
<xsd:attribute name="hostname-pattern" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="element" mixed="true">
<xsd:attribute name="key" type="xsd:string" />
<xsd:complexType name="element">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="key" type="xsd:string" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:schema>

View File

@ -43,7 +43,7 @@ class UrlMatcher implements UrlMatcherInterface
/**
* @var RouteCollection
*/
private $routes;
protected $routes;
/**
* Constructor.
@ -157,10 +157,30 @@ class UrlMatcher implements UrlMatcherInterface
continue;
}
return $this->mergeDefaults(array_replace($matches, $hostnameMatches, array('_route' => $name)), $route->getDefaults());
return $this->getAttributes($route, $name, array_replace($matches, $hostnameMatches));
}
}
/**
* Returns an array of values to use as request attributes.
*
* As this method requires the Route object, it is not available
* in matchers that do not have access to the matched Route instance
* (like the PHP and Apache matcher dumpers).
*
* @param Route $route The route we are matching against
* @param string $name The name of the route
* @param array $attributes An array of attributes from the matcher
*
* @return array An array of parameters
*/
protected function getAttributes(Route $route, $name, array $attributes)
{
$attributes['_route'] = $name;
return $this->mergeDefaults($attributes, $route->getDefaults());
}
/**
* Handles specific route requirements.
*

View File

@ -195,6 +195,12 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
$this->logger->debug('Remember-me was requested; setting cookie.');
}
// Remove attribute from request that sets a NULL cookie.
// It was set by $this->cancelCookie()
// (cancelCookie does other things too for some RememberMeServices
// so we should still call it at the start of this method)
$request->attributes->remove(self::COOKIE_ATTR_NAME);
$this->onLoginSuccess($request, $response, $token);
}

View File

@ -133,7 +133,6 @@ class PersistentTokenBasedRememberMeServices extends AbstractRememberMeServices
)
);
$request->attributes->remove(self::COOKIE_ATTR_NAME);
$response->headers->setCookie(
new Cookie(
$this->options['name'],

View File

@ -172,9 +172,9 @@ class ExecutionContext implements ExecutionContextInterface
/**
* {@inheritdoc}
*/
public function getPropertyPath($subPath = null)
public function getPropertyPath($subPath = '')
{
if (null !== $subPath && '' !== $this->propertyPath && '' !== $subPath && '[' !== $subPath[0]) {
if ('' != $subPath && '' !== $this->propertyPath && '[' !== $subPath[0]) {
return $this->propertyPath . '.' . $subPath;
}
@ -240,7 +240,7 @@ class ExecutionContext implements ExecutionContextInterface
/**
* {@inheritdoc}
*/
public function validate($value, $groups = null, $subPath = '', $traverse = false, $deep = false)
public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false)
{
$propertyPath = $this->getPropertyPath($subPath);
@ -252,7 +252,7 @@ class ExecutionContext implements ExecutionContextInterface
/**
* {@inheritdoc}
*/
public function validateValue($value, $constraints, $groups = null, $subPath = '')
public function validateValue($value, $constraints, $subPath = '', $groups = null)
{
$constraints = is_array($constraints) ? $constraints : array($constraints);

View File

@ -142,15 +142,15 @@ interface ExecutionContextInterface
* Any violations generated during the validation will be added to the
* violation list that you can access with {@link getViolations}.
*
* @param mixed $value The value to validate.
* @param string $subPath The path to append to the context's property path.
* @param null $groups The groups to validate in. If you don't pass any
* groups here, the current group of the context
* will be used.
* @param bool $traverse Whether to traverse the value if it is an array
* or an instance of <tt>\Traversable</tt>.
* @param bool $deep Whether to traverse the value recursively if
* it is a collection of collections.
* @param mixed $value The value to validate.
* @param string $subPath The path to append to the context's property path.
* @param null|string|string[] $groups The groups to validate in. If you don't pass any
* groups here, the current group of the context
* will be used.
* @param Boolean $traverse Whether to traverse the value if it is an array
* or an instance of <tt>\Traversable</tt>.
* @param Boolean $deep Whether to traverse the value recursively if
* it is a collection of collections.
*/
public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false);
@ -177,7 +177,7 @@ interface ExecutionContextInterface
* @param mixed $value The value to validate.
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against.
* @param string $subPath The path to append to the context's property path.
* @param null $groups The groups to validate in. If you don't pass any
* @param null|string|string[] $groups The groups to validate in. If you don't pass any
* groups here, the current group of the context
* will be used.
*/
@ -300,5 +300,5 @@ interface ExecutionContextInterface
* string if the validator is currently validating the
* root value of the validation graph.
*/
public function getPropertyPath($subPath = null);
public function getPropertyPath($subPath = '');
}