Merge branch '2.7' into 2.8
This commit is contained in:
commit
3a57b77bc7
@ -185,7 +185,7 @@ class Client extends BaseClient
|
||||
$code = <<<EOF
|
||||
<?php
|
||||
|
||||
error_reporting($errorReporting & ~E_USER_DEPRECATED);
|
||||
error_reporting($errorReporting);
|
||||
|
||||
if ('$autoloader') {
|
||||
require_once '$autoloader';
|
||||
|
@ -33,7 +33,7 @@ class SymfonyQuestionHelper extends QuestionHelper
|
||||
{
|
||||
$validator = $question->getValidator();
|
||||
$question->setValidator(function ($value) use ($validator) {
|
||||
if (null !== $validator && is_callable($validator)) {
|
||||
if (null !== $validator) {
|
||||
$value = $validator($value);
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,7 @@ class Table
|
||||
$columns[] = $this->getNumberOfColumns($row);
|
||||
}
|
||||
|
||||
return $this->numberOfColumns = max($columns);
|
||||
$this->numberOfColumns = max($columns);
|
||||
}
|
||||
|
||||
private function buildTableRows($rows)
|
||||
@ -539,7 +539,7 @@ class Table
|
||||
*
|
||||
* @param array $row
|
||||
*
|
||||
* @return array()
|
||||
* @return array
|
||||
*/
|
||||
private function getRowColumns($row)
|
||||
{
|
||||
@ -578,8 +578,6 @@ class Table
|
||||
/**
|
||||
* Gets column width.
|
||||
*
|
||||
* @param int $column
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function getColumnSeparatorWidth()
|
||||
|
@ -26,7 +26,6 @@ class LegacyDefaultCsrfProviderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
ini_set('session.save_handler', 'files');
|
||||
ini_set('session.save_path', sys_get_temp_dir());
|
||||
ini_set('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
|
@ -105,7 +105,7 @@ class Client extends BaseClient
|
||||
$code = <<<EOF
|
||||
<?php
|
||||
|
||||
error_reporting($errorReporting & ~E_USER_DEPRECATED);
|
||||
error_reporting($errorReporting);
|
||||
|
||||
require_once '$requirePath';
|
||||
|
||||
|
@ -24,19 +24,74 @@ use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException;
|
||||
*/
|
||||
class PropertyAccessor implements PropertyAccessorInterface
|
||||
{
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const VALUE = 0;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const IS_REF = 1;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const IS_REF_CHAINED = 2;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const ACCESS_HAS_PROPERTY = 0;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const ACCESS_TYPE = 1;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const ACCESS_NAME = 2;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const ACCESS_REF = 3;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const ACCESS_ADDER = 4;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const ACCESS_REMOVER = 5;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const ACCESS_TYPE_METHOD = 0;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const ACCESS_TYPE_PROPERTY = 1;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const ACCESS_TYPE_MAGIC = 2;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const ACCESS_TYPE_ADDER_AND_REMOVER = 3;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const ACCESS_TYPE_NOT_FOUND = 4;
|
||||
|
||||
/**
|
||||
@ -62,6 +117,9 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
/**
|
||||
* Should not be used by application code. Use
|
||||
* {@link PropertyAccess::createPropertyAccessor()} instead.
|
||||
*
|
||||
* @param bool $magicCall
|
||||
* @param bool $throwExceptionOnInvalidIndex
|
||||
*/
|
||||
public function __construct($magicCall = false, $throwExceptionOnInvalidIndex = false)
|
||||
{
|
||||
@ -365,7 +423,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
}
|
||||
} elseif (!$access[self::ACCESS_HAS_PROPERTY] && property_exists($object, $property)) {
|
||||
// Needed to support \stdClass instances. We need to explicitly
|
||||
// exclude $classHasProperty, otherwise if in the previous clause
|
||||
// exclude $access[self::ACCESS_HAS_PROPERTY], otherwise if
|
||||
// a *protected* property was found on the class, property_exists()
|
||||
// returns true, consequently the following line will result in a
|
||||
// fatal error.
|
||||
@ -411,7 +469,6 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
$getsetter = lcfirst($camelProp); // jQuery style, e.g. read: last(), write: last($item)
|
||||
$isser = 'is'.$camelProp;
|
||||
$hasser = 'has'.$camelProp;
|
||||
$classHasProperty = $reflClass->hasProperty($property);
|
||||
|
||||
if ($reflClass->hasMethod($getter) && $reflClass->getMethod($getter)->isPublic()) {
|
||||
$access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD;
|
||||
@ -429,13 +486,10 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
$access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY;
|
||||
$access[self::ACCESS_NAME] = $property;
|
||||
$access[self::ACCESS_REF] = false;
|
||||
} elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) {
|
||||
} elseif ($access[self::ACCESS_HAS_PROPERTY] && $reflClass->getProperty($property)->isPublic()) {
|
||||
$access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY;
|
||||
$access[self::ACCESS_NAME] = $property;
|
||||
$access[self::ACCESS_REF] = true;
|
||||
|
||||
$result[self::VALUE] = &$object->$property;
|
||||
$result[self::IS_REF] = true;
|
||||
} elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) {
|
||||
// we call the getter and hope the __call do the job
|
||||
$access[self::ACCESS_TYPE] = self::ACCESS_TYPE_MAGIC;
|
||||
@ -506,7 +560,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
$this->writeCollection($object, $property, $value, $access[self::ACCESS_ADDER], $access[self::ACCESS_REMOVER]);
|
||||
} elseif (!$access[self::ACCESS_HAS_PROPERTY] && property_exists($object, $property)) {
|
||||
// Needed to support \stdClass instances. We need to explicitly
|
||||
// exclude $classHasProperty, otherwise if in the previous clause
|
||||
// exclude $access[self::ACCESS_HAS_PROPERTY], otherwise if
|
||||
// a *protected* property was found on the class, property_exists()
|
||||
// returns true, consequently the following line will result in a
|
||||
// fatal error.
|
||||
@ -579,7 +633,6 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
private function getWriteAccessInfo($object, $property, $value)
|
||||
{
|
||||
$key = get_class($object).'::'.$property;
|
||||
$guessedAdders = '';
|
||||
|
||||
if (isset($this->writePropertyCache[$key])) {
|
||||
$access = $this->writePropertyCache[$key];
|
||||
@ -594,13 +647,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
if (is_array($value) || $value instanceof \Traversable) {
|
||||
$methods = $this->findAdderAndRemover($reflClass, $singulars);
|
||||
|
||||
if (null === $methods) {
|
||||
// It is sufficient to include only the adders in the error
|
||||
// message. If the user implements the adder but not the remover,
|
||||
// an exception will be thrown in findAdderAndRemover() that
|
||||
// the remover has to be implemented as well.
|
||||
$guessedAdders = '"add'.implode('()", "add', $singulars).'()", ';
|
||||
} else {
|
||||
if (null !== $methods) {
|
||||
$access[self::ACCESS_TYPE] = self::ACCESS_TYPE_ADDER_AND_REMOVER;
|
||||
$access[self::ACCESS_ADDER] = $methods[0];
|
||||
$access[self::ACCESS_REMOVER] = $methods[1];
|
||||
@ -608,11 +655,9 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
}
|
||||
|
||||
if (!isset($access[self::ACCESS_TYPE])) {
|
||||
$setter = 'set'.$this->camelize($property);
|
||||
$setter = 'set'.$camelized;
|
||||
$getsetter = lcfirst($camelized); // jQuery style, e.g. read: last(), write: last($item)
|
||||
|
||||
$classHasProperty = $reflClass->hasProperty($property);
|
||||
|
||||
if ($this->isMethodAccessible($reflClass, $setter, 1)) {
|
||||
$access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD;
|
||||
$access[self::ACCESS_NAME] = $setter;
|
||||
@ -622,7 +667,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
} elseif ($this->isMethodAccessible($reflClass, '__set', 2)) {
|
||||
$access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY;
|
||||
$access[self::ACCESS_NAME] = $property;
|
||||
} elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) {
|
||||
} elseif ($access[self::ACCESS_HAS_PROPERTY] && $reflClass->getProperty($property)->isPublic()) {
|
||||
$access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY;
|
||||
$access[self::ACCESS_NAME] = $property;
|
||||
} elseif ($this->magicCall && $this->isMethodAccessible($reflClass, '__call', 2)) {
|
||||
|
@ -32,7 +32,7 @@ interface AuthenticationEntryPointInterface
|
||||
*
|
||||
* Examples:
|
||||
* A) For a form login, you might redirect to the login page
|
||||
* return new Response('/login');
|
||||
* return new RedirectResponse('/login');
|
||||
* B) For an API token authentication system, you return a 401 response
|
||||
* return new Response('Auth header required', 401);
|
||||
*
|
||||
|
Reference in New Issue
Block a user