mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-23 03:19:10 -04:00
ALPHA 3.0.2a
This commit is contained in:
8
vendor/symfony/http-kernel/Bundle/Bundle.php
vendored
8
vendor/symfony/http-kernel/Bundle/Bundle.php
vendored
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Bundle;
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ abstract class Bundle implements BundleInterface
|
||||
|
||||
if (null !== $extension) {
|
||||
if (!$extension instanceof ExtensionInterface) {
|
||||
throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', get_class($extension)));
|
||||
throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', \get_class($extension)));
|
||||
}
|
||||
|
||||
// check naming convention
|
||||
@@ -120,7 +120,7 @@ abstract class Bundle implements BundleInterface
|
||||
{
|
||||
if (null === $this->path) {
|
||||
$reflected = new \ReflectionObject($this);
|
||||
$this->path = dirname($reflected->getFileName());
|
||||
$this->path = \dirname($reflected->getFileName());
|
||||
}
|
||||
|
||||
return $this->path;
|
||||
|
||||
@@ -20,7 +20,7 @@ abstract class CacheWarmer implements CacheWarmerInterface
|
||||
{
|
||||
protected function writeCacheFile($file, $content)
|
||||
{
|
||||
$tmpFile = @tempnam(dirname($file), basename($file));
|
||||
$tmpFile = @tempnam(\dirname($file), basename($file));
|
||||
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
|
||||
@chmod($file, 0666 & ~umask());
|
||||
|
||||
|
||||
8
vendor/symfony/http-kernel/Client.php
vendored
8
vendor/symfony/http-kernel/Client.php
vendored
@@ -12,10 +12,10 @@
|
||||
namespace Symfony\Component\HttpKernel;
|
||||
|
||||
use Symfony\Component\BrowserKit\Client as BaseClient;
|
||||
use Symfony\Component\BrowserKit\CookieJar;
|
||||
use Symfony\Component\BrowserKit\History;
|
||||
use Symfony\Component\BrowserKit\Request as DomRequest;
|
||||
use Symfony\Component\BrowserKit\Response as DomResponse;
|
||||
use Symfony\Component\BrowserKit\History;
|
||||
use Symfony\Component\BrowserKit\CookieJar;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -89,7 +89,7 @@ class Client extends BaseClient
|
||||
foreach (get_declared_classes() as $class) {
|
||||
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
|
||||
$r = new \ReflectionClass($class);
|
||||
$file = dirname(dirname($r->getFileName())).'/autoload.php';
|
||||
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
|
||||
if (file_exists($file)) {
|
||||
$requires .= "require_once '".str_replace("'", "\\'", $file)."';\n";
|
||||
}
|
||||
@@ -160,7 +160,7 @@ EOF;
|
||||
{
|
||||
$filtered = array();
|
||||
foreach ($files as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
if (\is_array($value)) {
|
||||
$filtered[$key] = $this->filterFiles($value);
|
||||
} elseif ($value instanceof UploadedFile) {
|
||||
if ($value->isValid() && $value->getSize() > UploadedFile::getMaxFilesize()) {
|
||||
|
||||
@@ -56,7 +56,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
|
||||
$resolved = $resolver->resolve($request, $metadata);
|
||||
|
||||
if (!$resolved instanceof \Generator) {
|
||||
throw new \InvalidArgumentException(sprintf('%s::resolve() must yield at least one value.', get_class($resolver)));
|
||||
throw new \InvalidArgumentException(sprintf('%s::resolve() must yield at least one value.', \get_class($resolver)));
|
||||
}
|
||||
|
||||
foreach ($resolved as $append) {
|
||||
@@ -69,10 +69,10 @@ final class ArgumentResolver implements ArgumentResolverInterface
|
||||
|
||||
$representative = $controller;
|
||||
|
||||
if (is_array($representative)) {
|
||||
$representative = sprintf('%s::%s()', get_class($representative[0]), $representative[1]);
|
||||
} elseif (is_object($representative)) {
|
||||
$representative = get_class($representative);
|
||||
if (\is_array($representative)) {
|
||||
$representative = sprintf('%s::%s()', \get_class($representative[0]), $representative[1]);
|
||||
} elseif (\is_object($representative)) {
|
||||
$representative = \get_class($representative);
|
||||
}
|
||||
|
||||
throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.', $representative, $metadata->getName()));
|
||||
|
||||
@@ -37,8 +37,8 @@ final class VariadicValueResolver implements ArgumentValueResolverInterface
|
||||
{
|
||||
$values = $request->attributes->get($argument->getName());
|
||||
|
||||
if (!is_array($values)) {
|
||||
throw new \InvalidArgumentException(sprintf('The action argument "...$%1$s" is required to be an array, the request attribute "%1$s" contains a type of "%2$s" instead.', $argument->getName(), gettype($values)));
|
||||
if (!\is_array($values)) {
|
||||
throw new \InvalidArgumentException(sprintf('The action argument "...$%1$s" is required to be an array, the request attribute "%1$s" contains a type of "%2$s" instead.', $argument->getName(), \gettype($values)));
|
||||
}
|
||||
|
||||
foreach ($values as $value) {
|
||||
|
||||
@@ -43,8 +43,8 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_array($controller)) {
|
||||
if (isset($controller[0]) && is_string($controller[0]) && isset($controller[1])) {
|
||||
if (\is_array($controller)) {
|
||||
if (isset($controller[0]) && \is_string($controller[0]) && isset($controller[1])) {
|
||||
try {
|
||||
$controller[0] = $this->instantiateController($controller[0]);
|
||||
} catch (\Error | \LogicException $e) {
|
||||
@@ -63,28 +63,28 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_callable($controller)) {
|
||||
if (!\is_callable($controller)) {
|
||||
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $this->getControllerError($controller)));
|
||||
}
|
||||
|
||||
return $controller;
|
||||
}
|
||||
|
||||
if (is_object($controller)) {
|
||||
if (!is_callable($controller)) {
|
||||
if (\is_object($controller)) {
|
||||
if (!\is_callable($controller)) {
|
||||
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $this->getControllerError($controller)));
|
||||
}
|
||||
|
||||
return $controller;
|
||||
}
|
||||
|
||||
if (function_exists($controller)) {
|
||||
if (\function_exists($controller)) {
|
||||
return $controller;
|
||||
}
|
||||
|
||||
$callable = $this->createController($controller);
|
||||
|
||||
if (!is_callable($callable)) {
|
||||
if (!\is_callable($callable)) {
|
||||
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $this->getControllerError($callable)));
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
|
||||
private function getControllerError($callable)
|
||||
{
|
||||
if (is_string($callable)) {
|
||||
if (\is_string($callable)) {
|
||||
if (false !== strpos($callable, '::')) {
|
||||
$callable = explode('::', $callable, 2);
|
||||
} else {
|
||||
@@ -143,28 +143,28 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
}
|
||||
}
|
||||
|
||||
if (is_object($callable)) {
|
||||
if (\is_object($callable)) {
|
||||
$availableMethods = $this->getClassMethodsWithoutMagicMethods($callable);
|
||||
$alternativeMsg = $availableMethods ? sprintf(' or use one of the available methods: "%s"', implode('", "', $availableMethods)) : '';
|
||||
|
||||
return sprintf('Controller class "%s" cannot be called without a method name. You need to implement "__invoke"%s.', get_class($callable), $alternativeMsg);
|
||||
return sprintf('Controller class "%s" cannot be called without a method name. You need to implement "__invoke"%s.', \get_class($callable), $alternativeMsg);
|
||||
}
|
||||
|
||||
if (!is_array($callable)) {
|
||||
return sprintf('Invalid type for controller given, expected string, array or object, got "%s".', gettype($callable));
|
||||
if (!\is_array($callable)) {
|
||||
return sprintf('Invalid type for controller given, expected string, array or object, got "%s".', \gettype($callable));
|
||||
}
|
||||
|
||||
if (!isset($callable[0]) || !isset($callable[1]) || 2 !== count($callable)) {
|
||||
if (!isset($callable[0]) || !isset($callable[1]) || 2 !== \count($callable)) {
|
||||
return 'Invalid array callable, expected array(controller, method).';
|
||||
}
|
||||
|
||||
list($controller, $method) = $callable;
|
||||
|
||||
if (is_string($controller) && !class_exists($controller)) {
|
||||
if (\is_string($controller) && !class_exists($controller)) {
|
||||
return sprintf('Class "%s" does not exist.', $controller);
|
||||
}
|
||||
|
||||
$className = is_object($controller) ? get_class($controller) : $controller;
|
||||
$className = \is_object($controller) ? \get_class($controller) : $controller;
|
||||
|
||||
if (method_exists($controller, $method)) {
|
||||
return sprintf('Method "%s" on class "%s" should be public and non-abstract.', $method, $className);
|
||||
@@ -177,7 +177,7 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
foreach ($collection as $item) {
|
||||
$lev = levenshtein($method, $item);
|
||||
|
||||
if ($lev <= strlen($method) / 3 || false !== strpos($item, $method)) {
|
||||
if ($lev <= \strlen($method) / 3 || false !== strpos($item, $method)) {
|
||||
$alternatives[] = $item;
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
|
||||
$message = sprintf('Expected method "%s" on class "%s"', $method, $className);
|
||||
|
||||
if (count($alternatives) > 0) {
|
||||
if (\count($alternatives) > 0) {
|
||||
$message .= sprintf(', did you mean "%s"?', implode('", "', $alternatives));
|
||||
} else {
|
||||
$message .= sprintf('. Available methods: "%s".', implode('", "', $collection));
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Controller;
|
||||
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Controller;
|
||||
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
|
||||
@@ -25,9 +25,9 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
|
||||
{
|
||||
$arguments = array();
|
||||
|
||||
if (is_array($controller)) {
|
||||
if (\is_array($controller)) {
|
||||
$reflection = new \ReflectionMethod($controller[0], $controller[1]);
|
||||
} elseif (is_object($controller) && !$controller instanceof \Closure) {
|
||||
} elseif (\is_object($controller) && !$controller instanceof \Closure) {
|
||||
$reflection = (new \ReflectionObject($controller))->getMethod('__invoke');
|
||||
} else {
|
||||
$reflection = new \ReflectionFunction($controller);
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\DataCollector;
|
||||
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\VarDumper\Caster\LinkStub;
|
||||
|
||||
/**
|
||||
@@ -67,11 +67,11 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
'php_architecture' => PHP_INT_SIZE * 8,
|
||||
'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
|
||||
'php_timezone' => date_default_timezone_get(),
|
||||
'xdebug_enabled' => extension_loaded('xdebug'),
|
||||
'apcu_enabled' => extension_loaded('apcu') && ini_get('apc.enabled'),
|
||||
'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'),
|
||||
'xdebug_enabled' => \extension_loaded('xdebug'),
|
||||
'apcu_enabled' => \extension_loaded('apcu') && ini_get('apc.enabled'),
|
||||
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && ini_get('opcache.enable'),
|
||||
'bundles' => array(),
|
||||
'sapi_name' => PHP_SAPI,
|
||||
'sapi_name' => \PHP_SAPI,
|
||||
);
|
||||
|
||||
if (isset($this->kernel)) {
|
||||
|
||||
@@ -80,7 +80,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
|
||||
'*' => function ($v, array $a, Stub $s, $isNested) {
|
||||
if (!$v instanceof Stub) {
|
||||
foreach ($a as $k => $v) {
|
||||
if (is_object($v) && !$v instanceof \DateTimeInterface && !$v instanceof Stub) {
|
||||
if (\is_object($v) && !$v instanceof \DateTimeInterface && !$v instanceof Stub) {
|
||||
$a[$k] = new CutStub($v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ use Symfony\Component\VarDumper\Cloner\Data;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||
use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
use Symfony\Component\VarDumper\Dumper\DataDumperInterface;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
use Symfony\Component\VarDumper\Server\Connection;
|
||||
|
||||
/**
|
||||
@@ -154,7 +154,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
parent::unserialize($data);
|
||||
$charset = array_pop($this->data);
|
||||
$fileLinkFormat = array_pop($this->data);
|
||||
$this->dataCount = count($this->data);
|
||||
$this->dataCount = \count($this->data);
|
||||
self::__construct($this->stopwatch, $fileLinkFormat, $charset);
|
||||
}
|
||||
|
||||
@@ -198,13 +198,13 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
$this->isCollected = true;
|
||||
|
||||
$h = headers_list();
|
||||
$i = count($h);
|
||||
$i = \count($h);
|
||||
array_unshift($h, 'Content-Type: '.ini_get('default_mimetype'));
|
||||
while (0 !== stripos($h[$i], 'Content-Type:')) {
|
||||
--$i;
|
||||
}
|
||||
|
||||
if (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html')) {
|
||||
if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html')) {
|
||||
$dumper = new HtmlDumper('php://output', $this->charset);
|
||||
$dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
|
||||
} else {
|
||||
@@ -230,7 +230,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
$s = $this->style('meta', '%s');
|
||||
$f = strip_tags($this->style('', $file));
|
||||
$name = strip_tags($this->style('', $name));
|
||||
if ($fmt && $link = is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line)) {
|
||||
if ($fmt && $link = \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line)) {
|
||||
$name = sprintf('<a href="%s" title="%s">'.$s.'</a>', strip_tags($this->style('', $link)), $f, $name);
|
||||
} else {
|
||||
$name = sprintf('<abbr title="%s">'.$s.'</abbr>', $f, $name);
|
||||
|
||||
@@ -223,7 +223,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($exception instanceof \ErrorException && in_array($exception->getSeverity(), array(E_DEPRECATED, E_USER_DEPRECATED), true)) {
|
||||
if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), array(E_DEPRECATED, E_USER_DEPRECATED), true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,9 +98,9 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
$memoryLimit = strtolower($memoryLimit);
|
||||
$max = strtolower(ltrim($memoryLimit, '+'));
|
||||
if (0 === strpos($max, '0x')) {
|
||||
$max = intval($max, 16);
|
||||
$max = \intval($max, 16);
|
||||
} elseif (0 === strpos($max, '0')) {
|
||||
$max = intval($max, 8);
|
||||
$max = \intval($max, 8);
|
||||
} else {
|
||||
$max = (int) $max;
|
||||
}
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\DataCollector;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
@@ -42,7 +42,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
$route = '';
|
||||
foreach ($request->attributes->all() as $key => $value) {
|
||||
if ('_route' === $key) {
|
||||
$route = is_object($value) ? $value->getPath() : $value;
|
||||
$route = \is_object($value) ? $value->getPath() : $value;
|
||||
$attributes[$key] = $route;
|
||||
} else {
|
||||
$attributes[$key] = $value;
|
||||
@@ -124,7 +124,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
}
|
||||
|
||||
foreach ($this->data as $key => $value) {
|
||||
if (!is_array($value)) {
|
||||
if (!\is_array($value)) {
|
||||
continue;
|
||||
}
|
||||
if ('request_headers' === $key || 'response_headers' === $key) {
|
||||
@@ -157,7 +157,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
));
|
||||
}
|
||||
|
||||
$this->data['identifier'] = $this->data['route'] ?: (is_array($this->data['controller']) ? $this->data['controller']['class'].'::'.$this->data['controller']['method'].'()' : $this->data['controller']);
|
||||
$this->data['identifier'] = $this->data['route'] ?: (\is_array($this->data['controller']) ? $this->data['controller']['class'].'::'.$this->data['controller']['method'].'()' : $this->data['controller']);
|
||||
|
||||
if ($response->headers->has('x-previous-debug-token')) {
|
||||
$this->data['forward_token'] = $response->headers->get('x-previous-debug-token');
|
||||
@@ -372,25 +372,25 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
*/
|
||||
protected function parseController($controller)
|
||||
{
|
||||
if (is_string($controller) && false !== strpos($controller, '::')) {
|
||||
if (\is_string($controller) && false !== strpos($controller, '::')) {
|
||||
$controller = explode('::', $controller);
|
||||
}
|
||||
|
||||
if (is_array($controller)) {
|
||||
if (\is_array($controller)) {
|
||||
try {
|
||||
$r = new \ReflectionMethod($controller[0], $controller[1]);
|
||||
|
||||
return array(
|
||||
'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0],
|
||||
'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0],
|
||||
'method' => $controller[1],
|
||||
'file' => $r->getFileName(),
|
||||
'line' => $r->getStartLine(),
|
||||
);
|
||||
} catch (\ReflectionException $e) {
|
||||
if (is_callable($controller)) {
|
||||
if (\is_callable($controller)) {
|
||||
// using __call or __callStatic
|
||||
return array(
|
||||
'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0],
|
||||
'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0],
|
||||
'method' => $controller[1],
|
||||
'file' => 'n/a',
|
||||
'line' => 'n/a',
|
||||
@@ -410,7 +410,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
);
|
||||
}
|
||||
|
||||
if (is_object($controller)) {
|
||||
if (\is_object($controller)) {
|
||||
$r = new \ReflectionClass($controller);
|
||||
|
||||
return array(
|
||||
@@ -421,6 +421,6 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
);
|
||||
}
|
||||
|
||||
return is_string($controller) ? $controller : 'n/a';
|
||||
return \is_string($controller) ? $controller : 'n/a';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\DataCollector;
|
||||
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,8 +34,8 @@ class FileLinkFormatter implements \Serializable
|
||||
public function __construct($fileLinkFormat = null, RequestStack $requestStack = null, string $baseDir = null, $urlFormat = null)
|
||||
{
|
||||
$fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
|
||||
if ($fileLinkFormat && !is_array($fileLinkFormat)) {
|
||||
$i = strpos($f = $fileLinkFormat, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: strlen($f);
|
||||
if ($fileLinkFormat && !\is_array($fileLinkFormat)) {
|
||||
$i = strpos($f = $fileLinkFormat, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f);
|
||||
$fileLinkFormat = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class FileLinkFormatter implements \Serializable
|
||||
if ($fmt = $this->getFileLinkFormat()) {
|
||||
for ($i = 1; isset($fmt[$i]); ++$i) {
|
||||
if (0 === strpos($file, $k = $fmt[$i++])) {
|
||||
$file = substr_replace($file, $fmt[$i], 0, strlen($k));
|
||||
$file = substr_replace($file, $fmt[$i], 0, \strlen($k));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class FileLinkFormatter implements \Serializable
|
||||
|
||||
return array(
|
||||
$request->getSchemeAndHttpHost().$request->getBaseUrl().$this->urlFormat,
|
||||
$this->baseDir.DIRECTORY_SEPARATOR, '',
|
||||
$this->baseDir.\DIRECTORY_SEPARATOR, '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\HttpKernel\Debug;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher as BaseTraceableEventDispatcher;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
|
||||
/**
|
||||
* Collects some data about event listeners.
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace Symfony\Component\HttpKernel\DependencyInjection;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Symfony\Component\Debug\DebugClassLoader;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
/**
|
||||
@@ -88,7 +88,7 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface
|
||||
$classes = array();
|
||||
|
||||
foreach (spl_autoload_functions() as $function) {
|
||||
if (!is_array($function)) {
|
||||
if (!\is_array($function)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface
|
||||
$function = $function[0]->getClassLoader();
|
||||
}
|
||||
|
||||
if (is_array($function) && $function[0] instanceof ClassLoader) {
|
||||
if (\is_array($function) && $function[0] instanceof ClassLoader) {
|
||||
$classes += array_filter($function[0]->getClassMap());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface;
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
namespace Symfony\Component\HttpKernel\DependencyInjection;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\HttpKernel\Log\Logger;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Log\Logger;
|
||||
|
||||
/**
|
||||
* Registers the default logger if necessary.
|
||||
|
||||
@@ -31,7 +31,7 @@ class MergeExtensionConfigurationPass extends BaseMergeExtensionConfigurationPas
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
foreach ($this->extensions as $extension) {
|
||||
if (!count($container->getExtensionConfig($extension))) {
|
||||
if (!\count($container->getExtensionConfig($extension))) {
|
||||
$container->loadFromExtension($extension, array());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
||||
while ($def instanceof ChildDefinition) {
|
||||
$def = $container->findDefinition($def->getParent());
|
||||
$class = $class ?: $def->getClass();
|
||||
$bindings = $def->getBindings();
|
||||
$bindings += $def->getBindings();
|
||||
}
|
||||
$class = $parameterBag->resolveValue($class);
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Event;
|
||||
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
/**
|
||||
* Allows filtering of controller arguments.
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Event;
|
||||
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
/**
|
||||
* Allows filtering of a controller callable.
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Event;
|
||||
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
/**
|
||||
* Allows to filter a Response object.
|
||||
|
||||
@@ -29,7 +29,7 @@ class GetResponseEvent extends KernelEvent
|
||||
/**
|
||||
* Returns the response object.
|
||||
*
|
||||
* @return Response
|
||||
* @return Response|null
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Event;
|
||||
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
/**
|
||||
* Allows to create a response for the return value of a controller.
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Event;
|
||||
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
/**
|
||||
* Allows to create a response for a thrown exception.
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Event;
|
||||
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
/**
|
||||
* Base class for events thrown in the HttpKernel component.
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Event;
|
||||
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
/**
|
||||
* Allows to execute logic after a response was sent.
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
/**
|
||||
* Sets the session onto the request on the "kernel.request" event and saves
|
||||
@@ -62,7 +62,7 @@ abstract class AbstractSessionListener implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
$session = $session ?? ($this->container && $this->container->has('initialized_session') ? $this->container->get('initialized_session') : null);
|
||||
$this->sessionUsageStack[] = $session instanceof Session ? $session->getUsageIndex() : null;
|
||||
$this->sessionUsageStack[] = $session instanceof Session ? $session->getUsageIndex() : 0;
|
||||
}
|
||||
|
||||
public function onKernelResponse(FilterResponseEvent $event)
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
|
||||
/**
|
||||
* TestSessionListener.
|
||||
@@ -73,6 +73,13 @@ abstract class AbstractTestSessionListener implements EventSubscriberInterface
|
||||
|
||||
if ($session instanceof Session ? !$session->isEmpty() || (null !== $this->sessionId && $session->getId() !== $this->sessionId) : $wasStarted) {
|
||||
$params = session_get_cookie_params();
|
||||
|
||||
foreach ($event->getResponse()->headers->getCookies() as $cookie) {
|
||||
if ($session->getName() === $cookie->getName() && $params['path'] === $cookie->getPath() && $params['domain'] == $cookie->getDomain()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$event->getResponse()->headers->setCookie(new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : time() + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly']));
|
||||
$this->sessionId = $session->getId();
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
|
||||
/**
|
||||
* Adds configured formats to each request.
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\ConsoleEvents;
|
||||
use Symfony\Component\Console\Event\ConsoleEvent;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
use Symfony\Component\Debug\ErrorHandler;
|
||||
use Symfony\Component\Debug\ExceptionHandler;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\Event\KernelEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Console\ConsoleEvents;
|
||||
use Symfony\Component\Console\Event\ConsoleEvent;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
|
||||
/**
|
||||
* Configures errors and exceptions handlers.
|
||||
@@ -70,14 +70,14 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
$this->firstCall = $this->hasTerminatedWithException = false;
|
||||
|
||||
$handler = set_exception_handler('var_dump');
|
||||
$handler = is_array($handler) ? $handler[0] : null;
|
||||
$handler = \is_array($handler) ? $handler[0] : null;
|
||||
restore_exception_handler();
|
||||
|
||||
if ($this->logger || null !== $this->throwAt) {
|
||||
if ($handler instanceof ErrorHandler) {
|
||||
if ($this->logger) {
|
||||
$handler->setDefaultLogger($this->logger, $this->levels);
|
||||
if (is_array($this->levels)) {
|
||||
if (\is_array($this->levels)) {
|
||||
$levels = 0;
|
||||
foreach ($this->levels as $type => $log) {
|
||||
$levels |= $type;
|
||||
@@ -126,7 +126,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
if ($this->exceptionHandler) {
|
||||
if ($handler instanceof ErrorHandler) {
|
||||
$h = $handler->setExceptionHandler('var_dump');
|
||||
if (is_array($h) && $h[0] instanceof ExceptionHandler) {
|
||||
if (\is_array($h) && $h[0] instanceof ExceptionHandler) {
|
||||
$handler->setExceptionHandler($h);
|
||||
$handler = $h[0];
|
||||
} else {
|
||||
@@ -147,7 +147,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
{
|
||||
$events = array(KernelEvents::REQUEST => array('configure', 2048));
|
||||
|
||||
if ('cli' === PHP_SAPI && defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) {
|
||||
if ('cli' === \PHP_SAPI && \defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) {
|
||||
$events[ConsoleEvents::COMMAND] = array('configure', 2048);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@ namespace Symfony\Component\HttpKernel\EventListener;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Debug\Exception\FlattenException;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
||||
|
||||
/**
|
||||
* ExceptionListener.
|
||||
@@ -45,19 +45,19 @@ class ExceptionListener implements EventSubscriberInterface
|
||||
{
|
||||
$exception = $event->getException();
|
||||
|
||||
$this->logException($exception, sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine()));
|
||||
$this->logException($exception, sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', \get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine()));
|
||||
}
|
||||
|
||||
public function onKernelException(GetResponseForExceptionEvent $event)
|
||||
{
|
||||
$exception = $event->getException();
|
||||
$request = $this->duplicateRequest($exception, $event->getRequest());
|
||||
$eventDispatcher = func_num_args() > 2 ? func_get_arg(2) : null;
|
||||
$eventDispatcher = \func_num_args() > 2 ? func_get_arg(2) : null;
|
||||
|
||||
try {
|
||||
$response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, false);
|
||||
} catch (\Exception $e) {
|
||||
$this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()));
|
||||
$this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', \get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()));
|
||||
|
||||
$wrapper = $e;
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\UriSigner;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
/**
|
||||
* Handles content fragments represented by special URIs.
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\RequestContextAwareInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Routing\RequestContextAwareInterface;
|
||||
|
||||
/**
|
||||
* Initializes the locale based on the current request.
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestMatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Profiler\Profiler;
|
||||
use Symfony\Component\HttpFoundation\RequestMatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
/**
|
||||
* ProfilerListener collects data for the current request by listening to the kernel events.
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
/**
|
||||
* ResponseListener fixes the Response headers based on the Request.
|
||||
|
||||
@@ -12,25 +12,25 @@
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
use Symfony\Component\Routing\Exception\NoConfigurationException;
|
||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
||||
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
|
||||
use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
|
||||
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
|
||||
use Symfony\Component\Routing\RequestContext;
|
||||
use Symfony\Component\Routing\RequestContextAwareInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Initializes the context from the request and sets request attributes based on a matching route.
|
||||
@@ -167,7 +167,7 @@ class RouterListener implements EventSubscriberInterface
|
||||
private function createWelcomeResponse()
|
||||
{
|
||||
$version = Kernel::VERSION;
|
||||
$baseDir = realpath($this->projectDir).DIRECTORY_SEPARATOR;
|
||||
$baseDir = realpath($this->projectDir).\DIRECTORY_SEPARATOR;
|
||||
$docVersion = substr(Kernel::VERSION, 0, 3);
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
/**
|
||||
* StreamedResponseListener is responsible for sending the Response
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
|
||||
use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
/**
|
||||
* SurrogateListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for Surrogates.
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
|
||||
@@ -92,13 +92,13 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere
|
||||
// we need to sign the absolute URI, but want to return the path only.
|
||||
$fragmentUri = $this->signer->sign($this->generateFragmentUri($uri, $request, true));
|
||||
|
||||
return substr($fragmentUri, strlen($request->getSchemeAndHttpHost()));
|
||||
return substr($fragmentUri, \strlen($request->getSchemeAndHttpHost()));
|
||||
}
|
||||
|
||||
private function containsNonScalars(array $values): bool
|
||||
{
|
||||
foreach ($values as $value) {
|
||||
if (is_array($value)) {
|
||||
if (\is_array($value)) {
|
||||
return $this->containsNonScalars($value);
|
||||
} elseif (!is_scalar($value) && null !== $value) {
|
||||
return true;
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Fragment;
|
||||
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\HttpKernel\Fragment;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
|
||||
/**
|
||||
* Interface implemented by all rendering strategies.
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Symfony\Component\HttpKernel\Fragment;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\UriSigner;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
use Twig\Environment;
|
||||
use Twig\Error\LoaderError;
|
||||
use Twig\Loader\ExistsLoaderInterface;
|
||||
@@ -89,7 +89,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
||||
}
|
||||
|
||||
// we need to sign the absolute URI, but want to return the path only.
|
||||
$uri = substr($this->signer->sign($this->generateFragmentUri($uri, $request, true)), strlen($request->getSchemeAndHttpHost()));
|
||||
$uri = substr($this->signer->sign($this->generateFragmentUri($uri, $request, true)), \strlen($request->getSchemeAndHttpHost()));
|
||||
}
|
||||
|
||||
// We need to replace ampersands in the URI with the encoded form in order to return valid html/xml content.
|
||||
@@ -102,12 +102,12 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
||||
$content = $template;
|
||||
}
|
||||
|
||||
$attributes = isset($options['attributes']) && is_array($options['attributes']) ? $options['attributes'] : array();
|
||||
$attributes = isset($options['attributes']) && \is_array($options['attributes']) ? $options['attributes'] : array();
|
||||
if (isset($options['id']) && $options['id']) {
|
||||
$attributes['id'] = $options['id'];
|
||||
}
|
||||
$renderedAttributes = '';
|
||||
if (count($attributes) > 0) {
|
||||
if (\count($attributes) > 0) {
|
||||
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
|
||||
foreach ($attributes as $attribute => $value) {
|
||||
$renderedAttributes .= sprintf(
|
||||
@@ -126,7 +126,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
||||
if ($this->templating instanceof EngineInterface) {
|
||||
try {
|
||||
return $this->templating->exists($template);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,14 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Fragment;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpKernel\HttpCache\SubRequestHandler;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
|
||||
/**
|
||||
* Implements the inline rendering strategy where the Request is rendered by the current HTTP kernel.
|
||||
@@ -76,7 +77,7 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer
|
||||
|
||||
$level = ob_get_level();
|
||||
try {
|
||||
return $this->kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false);
|
||||
return SubRequestHandler::handle($this->kernel, $subRequest, HttpKernelInterface::SUB_REQUEST, false);
|
||||
} catch (\Exception $e) {
|
||||
// we dispatch the exception event to trigger the logging
|
||||
// the response that comes back is simply ignored
|
||||
@@ -109,15 +110,6 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer
|
||||
$cookies = $request->cookies->all();
|
||||
$server = $request->server->all();
|
||||
|
||||
if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) {
|
||||
$currentXForwardedFor = $request->headers->get('X_FORWARDED_FOR', '');
|
||||
|
||||
$server['HTTP_X_FORWARDED_FOR'] = ($currentXForwardedFor ? $currentXForwardedFor.', ' : '').$request->getClientIp();
|
||||
}
|
||||
|
||||
$trustedProxies = Request::getTrustedProxies();
|
||||
$server['REMOTE_ADDR'] = $trustedProxies ? reset($trustedProxies) : '127.0.0.1';
|
||||
|
||||
unset($server['HTTP_IF_MODIFIED_SINCE']);
|
||||
unset($server['HTTP_IF_NONE_MATCH']);
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Fragment;
|
||||
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\EventListener\FragmentListener;
|
||||
|
||||
/**
|
||||
@@ -80,7 +80,7 @@ abstract class RoutableFragmentRenderer implements FragmentRendererInterface
|
||||
private function checkNonScalar($values)
|
||||
{
|
||||
foreach ($values as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
if (\is_array($value)) {
|
||||
$this->checkNonScalar($value);
|
||||
} elseif (!is_scalar($value) && null !== $value) {
|
||||
throw new \LogicException(sprintf('Controller attributes cannot contain non-scalar/non-null values (value for key "%s" is not a scalar or null).', $key));
|
||||
|
||||
2
vendor/symfony/http-kernel/HttpCache/Esi.php
vendored
2
vendor/symfony/http-kernel/HttpCache/Esi.php
vendored
@@ -71,7 +71,7 @@ class Esi extends AbstractSurrogate
|
||||
}
|
||||
|
||||
$parts = explode(';', $type);
|
||||
if (!in_array($parts[0], $this->contentTypes)) {
|
||||
if (!\in_array($parts[0], $this->contentTypes)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\HttpCache;
|
||||
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\TerminableInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\TerminableInterface;
|
||||
|
||||
/**
|
||||
* Cache provides HTTP caching.
|
||||
@@ -370,7 +370,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
|
||||
// return the response and not the cache entry if the response is valid but not cached
|
||||
$etag = $response->getEtag();
|
||||
if ($etag && in_array($etag, $requestEtags) && !in_array($etag, $cachedEtags)) {
|
||||
if ($etag && \in_array($etag, $requestEtags) && !\in_array($etag, $cachedEtags)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -444,30 +444,11 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
$this->surrogate->addSurrogateCapability($request);
|
||||
}
|
||||
|
||||
// modify the X-Forwarded-For header if needed
|
||||
$forwardedFor = $request->headers->get('X-Forwarded-For');
|
||||
if ($forwardedFor) {
|
||||
$request->headers->set('X-Forwarded-For', $forwardedFor.', '.$request->server->get('REMOTE_ADDR'));
|
||||
} else {
|
||||
$request->headers->set('X-Forwarded-For', $request->server->get('REMOTE_ADDR'));
|
||||
}
|
||||
|
||||
// fix the client IP address by setting it to 127.0.0.1 as HttpCache
|
||||
// is always called from the same process as the backend.
|
||||
$request->server->set('REMOTE_ADDR', '127.0.0.1');
|
||||
|
||||
// make sure HttpCache is a trusted proxy
|
||||
if (!in_array('127.0.0.1', $trustedProxies = Request::getTrustedProxies())) {
|
||||
$trustedProxies[] = '127.0.0.1';
|
||||
Request::setTrustedProxies($trustedProxies, Request::HEADER_X_FORWARDED_ALL);
|
||||
}
|
||||
|
||||
// always a "master" request (as the real master request can be in cache)
|
||||
$response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $catch);
|
||||
// FIXME: we probably need to also catch exceptions if raw === true
|
||||
$response = SubRequestHandler::handle($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, $catch);
|
||||
|
||||
// we don't implement the stale-if-error on Requests, which is nonetheless part of the RFC
|
||||
if (null !== $entry && in_array($response->getStatusCode(), array(500, 502, 503, 504))) {
|
||||
if (null !== $entry && \in_array($response->getStatusCode(), array(500, 502, 503, 504))) {
|
||||
if (null === $age = $entry->headers->getCacheControlDirective('stale-if-error')) {
|
||||
$age = $this->options['stale_if_error'];
|
||||
}
|
||||
@@ -606,7 +587,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
$response->setContent(ob_get_clean());
|
||||
$response->headers->remove('X-Body-Eval');
|
||||
if (!$response->headers->has('Transfer-Encoding')) {
|
||||
$response->headers->set('Content-Length', strlen($response->getContent()));
|
||||
$response->headers->set('Content-Length', \strlen($response->getContent()));
|
||||
}
|
||||
} elseif ($response->headers->has('X-Body-File')) {
|
||||
// Response does not include possibly dynamic content (ESI, SSI), so we need
|
||||
@@ -640,7 +621,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
$key = strtolower(str_replace('HTTP_', '', $key));
|
||||
|
||||
if ('cookie' === $key) {
|
||||
if (count($request->cookies->all())) {
|
||||
if (\count($request->cookies->all())) {
|
||||
return true;
|
||||
}
|
||||
} elseif ($request->headers->has($key)) {
|
||||
|
||||
2
vendor/symfony/http-kernel/HttpCache/Ssi.php
vendored
2
vendor/symfony/http-kernel/HttpCache/Ssi.php
vendored
@@ -58,7 +58,7 @@ class Ssi extends AbstractSurrogate
|
||||
}
|
||||
|
||||
$parts = explode(';', $type);
|
||||
if (!in_array($parts[0], $this->contentTypes)) {
|
||||
if (!\in_array($parts[0], $this->contentTypes)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
12
vendor/symfony/http-kernel/HttpCache/Store.php
vendored
12
vendor/symfony/http-kernel/HttpCache/Store.php
vendored
@@ -66,7 +66,7 @@ class Store implements StoreInterface
|
||||
|
||||
if (!isset($this->locks[$key])) {
|
||||
$path = $this->getPath($key);
|
||||
if (!file_exists(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) {
|
||||
if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) {
|
||||
return $path;
|
||||
}
|
||||
$h = fopen($path, 'cb');
|
||||
@@ -185,7 +185,7 @@ class Store implements StoreInterface
|
||||
$response->headers->set('X-Content-Digest', $digest);
|
||||
|
||||
if (!$response->headers->has('Transfer-Encoding')) {
|
||||
$response->headers->set('Content-Length', strlen($response->getContent()));
|
||||
$response->headers->set('Content-Length', \strlen($response->getContent()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,17 +373,17 @@ class Store implements StoreInterface
|
||||
@ftruncate($fp, 0);
|
||||
@fseek($fp, 0);
|
||||
$len = @fwrite($fp, $data);
|
||||
if (strlen($data) !== $len) {
|
||||
if (\strlen($data) !== $len) {
|
||||
@ftruncate($fp, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!file_exists(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) {
|
||||
if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tmpFile = tempnam(dirname($path), basename($path));
|
||||
$tmpFile = tempnam(\dirname($path), basename($path));
|
||||
if (false === $fp = @fopen($tmpFile, 'wb')) {
|
||||
@unlink($tmpFile);
|
||||
|
||||
@@ -410,7 +410,7 @@ class Store implements StoreInterface
|
||||
|
||||
public function getPath($key)
|
||||
{
|
||||
return $this->root.DIRECTORY_SEPARATOR.substr($key, 0, 2).DIRECTORY_SEPARATOR.substr($key, 2, 2).DIRECTORY_SEPARATOR.substr($key, 4, 2).DIRECTORY_SEPARATOR.substr($key, 6);
|
||||
return $this->root.\DIRECTORY_SEPARATOR.substr($key, 0, 2).\DIRECTORY_SEPARATOR.substr($key, 2, 2).\DIRECTORY_SEPARATOR.substr($key, 4, 2).\DIRECTORY_SEPARATOR.substr($key, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
24
vendor/symfony/http-kernel/HttpKernel.php
vendored
24
vendor/symfony/http-kernel/HttpKernel.php
vendored
@@ -11,13 +11,15 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
|
||||
use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
||||
@@ -25,11 +27,9 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
|
||||
use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* HttpKernel notifies events to convert a Request object to a Response one.
|
||||
@@ -250,11 +250,11 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
|
||||
private function varToString($var): string
|
||||
{
|
||||
if (is_object($var)) {
|
||||
return sprintf('Object(%s)', get_class($var));
|
||||
if (\is_object($var)) {
|
||||
return sprintf('Object(%s)', \get_class($var));
|
||||
}
|
||||
|
||||
if (is_array($var)) {
|
||||
if (\is_array($var)) {
|
||||
$a = array();
|
||||
foreach ($var as $k => $v) {
|
||||
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
|
||||
@@ -263,7 +263,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
return sprintf('Array(%s)', implode(', ', $a));
|
||||
}
|
||||
|
||||
if (is_resource($var)) {
|
||||
if (\is_resource($var)) {
|
||||
return sprintf('Resource(%s)', get_resource_type($var));
|
||||
}
|
||||
|
||||
|
||||
60
vendor/symfony/http-kernel/Kernel.php
vendored
60
vendor/symfony/http-kernel/Kernel.php
vendored
@@ -13,28 +13,28 @@ namespace Symfony\Component\HttpKernel;
|
||||
|
||||
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
|
||||
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
|
||||
use Symfony\Component\Config\ConfigCache;
|
||||
use Symfony\Component\Config\Loader\DelegatingLoader;
|
||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\DirectoryLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\GlobFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\GlobFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\DirectoryLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||
use Symfony\Component\HttpKernel\Config\FileLocator;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\AddAnnotatedClassesToCachePass;
|
||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
||||
use Symfony\Component\Config\Loader\DelegatingLoader;
|
||||
use Symfony\Component\Config\ConfigCache;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
|
||||
|
||||
/**
|
||||
* The Kernel is the heart of the Symfony system.
|
||||
@@ -63,11 +63,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
private $requestStackSize = 0;
|
||||
private $resetServices = false;
|
||||
|
||||
const VERSION = '4.1.1';
|
||||
const VERSION_ID = 40101;
|
||||
const VERSION = '4.1.4';
|
||||
const VERSION_ID = 40104;
|
||||
const MAJOR_VERSION = 4;
|
||||
const MINOR_VERSION = 1;
|
||||
const RELEASE_VERSION = 1;
|
||||
const RELEASE_VERSION = 4;
|
||||
const EXTRA_VERSION = '';
|
||||
|
||||
const END_OF_MAINTENANCE = '01/2019';
|
||||
@@ -215,7 +215,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
public function getBundle($name)
|
||||
{
|
||||
if (!isset($this->bundles[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, get_class($this)));
|
||||
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, \get_class($this)));
|
||||
}
|
||||
|
||||
return $this->bundles[$name];
|
||||
@@ -268,7 +268,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
$resourceBundle = $bundle->getName();
|
||||
}
|
||||
|
||||
if (count($files) > 0) {
|
||||
if (\count($files) > 0) {
|
||||
return $first && $isResource ? $files[0] : $files;
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
{
|
||||
if (null === $this->rootDir) {
|
||||
$r = new \ReflectionObject($this);
|
||||
$this->rootDir = dirname($r->getFileName());
|
||||
$this->rootDir = \dirname($r->getFileName());
|
||||
}
|
||||
|
||||
return $this->rootDir;
|
||||
@@ -328,12 +328,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
{
|
||||
if (null === $this->projectDir) {
|
||||
$r = new \ReflectionObject($this);
|
||||
$dir = $rootDir = dirname($r->getFileName());
|
||||
$dir = $rootDir = \dirname($r->getFileName());
|
||||
while (!file_exists($dir.'/composer.json')) {
|
||||
if ($dir === dirname($dir)) {
|
||||
if ($dir === \dirname($dir)) {
|
||||
return $this->projectDir = $rootDir;
|
||||
}
|
||||
$dir = dirname($dir);
|
||||
$dir = \dirname($dir);
|
||||
}
|
||||
$this->projectDir = $dir;
|
||||
}
|
||||
@@ -481,7 +481,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
|
||||
if ($this->debug) {
|
||||
$collectedLogs = array();
|
||||
$previousHandler = defined('PHPUNIT_COMPOSER_INSTALL');
|
||||
$previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL');
|
||||
$previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
|
||||
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
|
||||
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
|
||||
@@ -497,7 +497,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
// Clean the trace by removing first frames added by the error handler itself.
|
||||
for ($i = 0; isset($backtrace[$i]); ++$i) {
|
||||
if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) {
|
||||
$backtrace = array_slice($backtrace, 1 + $i);
|
||||
$backtrace = \array_slice($backtrace, 1 + $i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -536,20 +536,20 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
error_reporting($errorLevel);
|
||||
}
|
||||
}
|
||||
$oldContainer = is_object($oldContainer) ? new \ReflectionClass($oldContainer) : false;
|
||||
$oldContainer = \is_object($oldContainer) ? new \ReflectionClass($oldContainer) : false;
|
||||
|
||||
$this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass());
|
||||
$this->container = require $cache->getPath();
|
||||
$this->container->set('kernel', $this);
|
||||
|
||||
if ($oldContainer && get_class($this->container) !== $oldContainer->name) {
|
||||
if ($oldContainer && \get_class($this->container) !== $oldContainer->name) {
|
||||
// Because concurrent requests might still be using them,
|
||||
// old container files are not removed immediately,
|
||||
// but on a next dump of the container.
|
||||
static $legacyContainers = array();
|
||||
$oldContainerDir = dirname($oldContainer->getFileName());
|
||||
$oldContainerDir = \dirname($oldContainer->getFileName());
|
||||
$legacyContainers[$oldContainerDir.'.legacy'] = true;
|
||||
foreach (glob(dirname($oldContainerDir).DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) {
|
||||
foreach (glob(\dirname($oldContainerDir).\DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) {
|
||||
if (!isset($legacyContainers[$legacyContainer]) && @unlink($legacyContainer)) {
|
||||
(new Filesystem())->remove(substr($legacyContainer, 0, -7));
|
||||
}
|
||||
@@ -574,7 +574,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
$bundlesMetadata = array();
|
||||
|
||||
foreach ($this->bundles as $name => $bundle) {
|
||||
$bundles[$name] = get_class($bundle);
|
||||
$bundles[$name] = \get_class($bundle);
|
||||
$bundlesMetadata[$name] = array(
|
||||
'path' => $bundle->getPath(),
|
||||
'namespace' => $bundle->getNamespace(),
|
||||
@@ -705,14 +705,14 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
));
|
||||
|
||||
$rootCode = array_pop($content);
|
||||
$dir = dirname($cache->getPath()).'/';
|
||||
$dir = \dirname($cache->getPath()).'/';
|
||||
$fs = new Filesystem();
|
||||
|
||||
foreach ($content as $file => $code) {
|
||||
$fs->dumpFile($dir.$file, $code);
|
||||
@chmod($dir.$file, 0666 & ~umask());
|
||||
}
|
||||
@unlink(dirname($dir.$file).'.legacy');
|
||||
@unlink(\dirname($dir.$file).'.legacy');
|
||||
|
||||
$cache->write($rootCode, $container->getResources());
|
||||
}
|
||||
@@ -750,7 +750,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
*/
|
||||
public static function stripComments($source)
|
||||
{
|
||||
if (!function_exists('token_get_all')) {
|
||||
if (!\function_exists('token_get_all')) {
|
||||
return $source;
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
|
||||
// replace multiple new lines with a single newline
|
||||
$rawChunk .= preg_replace(array('/\n{2,}/S'), "\n", $token[1]);
|
||||
} elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
|
||||
} elseif (\in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
|
||||
$ignoreSpace = true;
|
||||
} else {
|
||||
$rawChunk .= $token[1];
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel;
|
||||
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
|
||||
/**
|
||||
* The Kernel is the heart of the Symfony system.
|
||||
|
||||
2
vendor/symfony/http-kernel/Log/Logger.php
vendored
2
vendor/symfony/http-kernel/Log/Logger.php
vendored
@@ -58,7 +58,7 @@ class Logger extends AbstractLogger
|
||||
|
||||
$this->minLevelIndex = self::$levels[$minLevel];
|
||||
$this->formatter = $formatter ?: array($this, 'format');
|
||||
if (false === $this->handle = is_resource($output) ? $output : @fopen($output, 'a')) {
|
||||
if (false === $this->handle = \is_resource($output) ? $output : @fopen($output, 'a')) {
|
||||
throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
fseek($file, 0, SEEK_END);
|
||||
|
||||
$result = array();
|
||||
while (count($result) < $limit && $line = $this->readLineFromFile($file)) {
|
||||
while (\count($result) < $limit && $line = $this->readLineFromFile($file)) {
|
||||
$values = str_getcsv($line);
|
||||
list($csvToken, $csvIp, $csvMethod, $csvUrl, $csvTime, $csvParent, $csvStatusCode) = $values;
|
||||
$csvTime = (int) $csvTime;
|
||||
@@ -134,7 +134,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
$profileIndexed = is_file($file);
|
||||
if (!$profileIndexed) {
|
||||
// Create directory
|
||||
$dir = dirname($file);
|
||||
$dir = \dirname($file);
|
||||
if (!is_dir($dir) && false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
|
||||
throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $dir));
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Profiler;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
|
||||
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Profiler.
|
||||
@@ -100,7 +100,7 @@ class Profiler
|
||||
}
|
||||
|
||||
if (!($ret = $this->storage->write($profile)) && null !== $this->logger) {
|
||||
$this->logger->warning('Unable to store the profiler information.', array('configured_storage' => get_class($this->storage)));
|
||||
$this->logger->warning('Unable to store the profiler information.', array('configured_storage' => \get_class($this->storage)));
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\CacheClearer;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer;
|
||||
|
||||
class Psr6CacheClearerTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ class CacheWarmerTest extends TestCase
|
||||
public function testWriteCacheFileCreatesTheFile()
|
||||
{
|
||||
$warmer = new TestCacheWarmer(self::$cacheFile);
|
||||
$warmer->warmUp(dirname(self::$cacheFile));
|
||||
$warmer->warmUp(\dirname(self::$cacheFile));
|
||||
|
||||
$this->assertFileExists(self::$cacheFile);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class CacheWarmerTest extends TestCase
|
||||
{
|
||||
$nonWritableFile = '/this/file/is/very/probably/not/writable';
|
||||
$warmer = new TestCacheWarmer($nonWritableFile);
|
||||
$warmer->warmUp(dirname($nonWritableFile));
|
||||
$warmer->warmUp(\dirname($nonWritableFile));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\Client;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\HttpKernel\Client;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\TestClient;
|
||||
|
||||
/**
|
||||
@@ -119,7 +119,7 @@ class ClientTest extends TestCase
|
||||
$this->assertEquals(1, $file->getSize());
|
||||
}
|
||||
|
||||
$file->move(dirname($target), basename($target));
|
||||
$file->move(\dirname($target), basename($target));
|
||||
|
||||
$this->assertFileExists($target);
|
||||
unlink($target);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\Controller;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||
@@ -23,7 +24,6 @@ use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\ExtendingRequest;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\ExtendingSession;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\NullableController;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\VariadicController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class ArgumentResolverTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace Symfony\Component\HttpKernel\Tests\Controller;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
|
||||
|
||||
class ControllerResolverTest extends TestCase
|
||||
{
|
||||
@@ -146,8 +146,8 @@ class ControllerResolverTest extends TestCase
|
||||
public function getStaticControllers()
|
||||
{
|
||||
return array(
|
||||
array(AbstractController::class.'::staticAction', 'foo'),
|
||||
array(array(AbstractController::class, 'staticAction'), 'foo'),
|
||||
array(TestAbstractController::class.'::staticAction', 'foo'),
|
||||
array(array(TestAbstractController::class, 'staticAction'), 'foo'),
|
||||
array(PrivateConstructorController::class.'::staticAction', 'bar'),
|
||||
array(array(PrivateConstructorController::class, 'staticAction'), 'bar'),
|
||||
);
|
||||
@@ -238,7 +238,7 @@ class InvokableController
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractController
|
||||
abstract class TestAbstractController
|
||||
{
|
||||
public static function staticAction()
|
||||
{
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\DataCollector;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
class ConfigDataCollectorTest extends TestCase
|
||||
{
|
||||
@@ -38,9 +38,9 @@ class ConfigDataCollectorTest extends TestCase
|
||||
$this->assertSame(date_default_timezone_get(), $c->getPhpTimezone());
|
||||
$this->assertSame(Kernel::VERSION, $c->getSymfonyVersion());
|
||||
$this->assertNull($c->getToken());
|
||||
$this->assertSame(extension_loaded('xdebug'), $c->hasXDebug());
|
||||
$this->assertSame(extension_loaded('Zend OPcache') && ini_get('opcache.enable'), $c->hasZendOpcache());
|
||||
$this->assertSame(extension_loaded('apcu') && ini_get('apc.enabled'), $c->hasApcu());
|
||||
$this->assertSame(\extension_loaded('xdebug'), $c->hasXDebug());
|
||||
$this->assertSame(\extension_loaded('Zend OPcache') && ini_get('opcache.enable'), $c->hasZendOpcache());
|
||||
$this->assertSame(\extension_loaded('apcu') && ini_get('apc.enabled'), $c->hasApcu());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Symfony\Component\HttpKernel\Tests\DataCollector;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Debug\Exception\FlattenException;
|
||||
use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector;
|
||||
|
||||
class ExceptionDataCollectorTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\DataCollector;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\DataCollector\MemoryDataCollector;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\DataCollector\MemoryDataCollector;
|
||||
|
||||
class MemoryDataCollectorTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,20 +12,20 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\DataCollector;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||
use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface;
|
||||
use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\HttpKernel;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
|
||||
class RequestDataCollectorTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\DataCollector;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\DataCollector\TimeDataCollector;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\DataCollector\TimeDataCollector;
|
||||
|
||||
/**
|
||||
* @group time-sensitive
|
||||
|
||||
@@ -27,7 +27,7 @@ class FileLinkFormatterTest extends TestCase
|
||||
|
||||
public function testWhenFileLinkFormatAndNoRequest()
|
||||
{
|
||||
$file = __DIR__.DIRECTORY_SEPARATOR.'file.php';
|
||||
$file = __DIR__.\DIRECTORY_SEPARATOR.'file.php';
|
||||
|
||||
$sut = new FileLinkFormatter('debug://open?url=file://%f&line=%l', new RequestStack());
|
||||
|
||||
@@ -36,7 +36,7 @@ class FileLinkFormatterTest extends TestCase
|
||||
|
||||
public function testWhenFileLinkFormatAndRequest()
|
||||
{
|
||||
$file = __DIR__.DIRECTORY_SEPARATOR.'file.php';
|
||||
$file = __DIR__.\DIRECTORY_SEPARATOR.'file.php';
|
||||
$baseDir = __DIR__;
|
||||
$requestStack = new RequestStack();
|
||||
$request = new Request();
|
||||
@@ -49,7 +49,7 @@ class FileLinkFormatterTest extends TestCase
|
||||
|
||||
public function testWhenNoFileLinkFormatAndRequest()
|
||||
{
|
||||
$file = __DIR__.DIRECTORY_SEPARATOR.'file.php';
|
||||
$file = __DIR__.\DIRECTORY_SEPARATOR.'file.php';
|
||||
$requestStack = new RequestStack();
|
||||
$request = new Request();
|
||||
$requestStack->push($request);
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace Symfony\Component\HttpKernel\Tests\Debug;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher;
|
||||
use Symfony\Component\HttpKernel\HttpKernel;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
|
||||
class TraceableEventDispatcherTest extends TestCase
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler;
|
||||
|
||||
class LazyLoadingFragmentHandlerTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\LoggerPass;
|
||||
use Symfony\Component\HttpKernel\Log\Logger;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* @author Kévin Dunglas <dunglas@gmail.com>
|
||||
|
||||
@@ -13,13 +13,14 @@ namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
|
||||
use Symfony\Component\DependencyInjection\ChildDefinition;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\ServiceLocator;
|
||||
use Symfony\Component\DependencyInjection\TypedReference;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass;
|
||||
|
||||
class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
||||
@@ -339,6 +340,29 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
||||
$this->assertTrue($container->has((string) $reference));
|
||||
$this->assertSame('foo_val', $container->get((string) $reference));
|
||||
}
|
||||
|
||||
public function testBindingsOnChildDefinitions()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$resolver = $container->register('argument_resolver.service')->addArgument(array());
|
||||
|
||||
$container->register('parent', ArgumentWithoutTypeController::class);
|
||||
|
||||
$container->setDefinition('child', (new ChildDefinition('parent'))
|
||||
->setBindings(array('$someArg' => new Reference('parent')))
|
||||
->addTag('controller.service_arguments')
|
||||
);
|
||||
|
||||
$pass = new RegisterControllerArgumentLocatorsPass();
|
||||
$pass->process($container);
|
||||
|
||||
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
|
||||
$this->assertInstanceOf(ServiceClosureArgument::class, $locator['child::fooAction']);
|
||||
|
||||
$locator = $container->getDefinition((string) $locator['child::fooAction']->getValues()[0])->getArgument(0);
|
||||
$this->assertInstanceOf(ServiceClosureArgument::class, $locator['someArg']);
|
||||
$this->assertEquals(new Reference('parent'), $locator['someArg']->getValues()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
class RegisterTestController
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Event;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\Tests\TestHttpKernel;
|
||||
|
||||
class FilterControllerArgumentsEventTest extends TestCase
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\EventListener;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LogLevel;
|
||||
use Symfony\Component\Console\Event\ConsoleEvent;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\ConsoleEvents;
|
||||
use Symfony\Component\Console\Event\ConsoleEvent;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
@@ -13,14 +13,14 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\EventListener\ExceptionListener;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\EventListener\ExceptionListener;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
||||
use Symfony\Component\HttpKernel\Tests\Logger;
|
||||
|
||||
/**
|
||||
@@ -37,9 +37,9 @@ class ExceptionListenerTest extends TestCase
|
||||
$logger = new TestLogger();
|
||||
$l = new ExceptionListener('foo', $logger);
|
||||
|
||||
$_logger = new \ReflectionProperty(get_class($l), 'logger');
|
||||
$_logger = new \ReflectionProperty(\get_class($l), 'logger');
|
||||
$_logger->setAccessible(true);
|
||||
$_controller = new \ReflectionProperty(get_class($l), 'controller');
|
||||
$_controller = new \ReflectionProperty(\get_class($l), 'controller');
|
||||
$_controller->setAccessible(true);
|
||||
|
||||
$this->assertSame($logger, $_logger->getValue($l));
|
||||
@@ -161,7 +161,7 @@ class TestLogger extends Logger implements DebugLoggerInterface
|
||||
{
|
||||
public function countErrors()
|
||||
{
|
||||
return count($this->logs['critical']);
|
||||
return \count($this->logs['critical']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\EventListener;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\EventListener\FragmentListener;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\EventListener\FragmentListener;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\UriSigner;
|
||||
|
||||
class FragmentListenerTest extends TestCase
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\EventListener\LocaleListener;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
|
||||
class LocaleListenerTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\EventListener\ProfilerListener;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
|
||||
use Symfony\Component\HttpKernel\EventListener\ProfilerListener;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\EventListener;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\EventListener\ResponseListener;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\EventListener\ResponseListener;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
|
||||
class ResponseListenerTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -18,12 +18,12 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\EventListener\ExceptionListener;
|
||||
use Symfony\Component\HttpKernel\EventListener\RouterListener;
|
||||
use Symfony\Component\HttpKernel\EventListener\ValidateRequestListener;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\HttpKernel;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\Routing\Exception\NoConfigurationException;
|
||||
use Symfony\Component\Routing\RequestContext;
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ use Symfony\Component\DependencyInjection\ServiceLocator;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\EventListener\AbstractSessionListener;
|
||||
use Symfony\Component\HttpKernel\EventListener\SessionListener;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\EventListener;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Esi;
|
||||
use Symfony\Component\HttpKernel\EventListener\SurrogateListener;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\EventListener\SurrogateListener;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Esi;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
|
||||
class SurrogateListenerTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -13,14 +13,14 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\EventListener\SessionListener;
|
||||
use Symfony\Component\HttpKernel\EventListener\TestSessionListener;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
/**
|
||||
* SessionListenerTest.
|
||||
@@ -106,6 +106,36 @@ class TestSessionListenerTest extends TestCase
|
||||
$this->assertNotEmpty($response->headers->getCookies());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider anotherCookieProvider
|
||||
*/
|
||||
public function testSessionWithNewSessionIdAndNewCookieDoesNotSendAnotherCookie($existing, array $expected)
|
||||
{
|
||||
$this->sessionHasBeenStarted();
|
||||
$this->sessionIsEmpty();
|
||||
$this->fixSessionId('456');
|
||||
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
$request = Request::create('/', 'GET', array(), array('MOCKSESSID' => '123'));
|
||||
$event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
|
||||
$this->listener->onKernelRequest($event);
|
||||
|
||||
$response = new Response('', 200, array('Set-Cookie' => $existing));
|
||||
|
||||
$response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST, $response);
|
||||
|
||||
$this->assertSame($expected, $response->headers->get('Set-Cookie', null, false));
|
||||
}
|
||||
|
||||
public function anotherCookieProvider()
|
||||
{
|
||||
return array(
|
||||
'same' => array('MOCKSESSID=789; path=/', array('MOCKSESSID=789; path=/')),
|
||||
'different domain' => array('MOCKSESSID=789; path=/; domain=example.com', array('MOCKSESSID=789; path=/; domain=example.com', 'MOCKSESSID=456; path=/')),
|
||||
'different path' => array('MOCKSESSID=789; path=/foo', array('MOCKSESSID=789; path=/foo', 'MOCKSESSID=456; path=/')),
|
||||
);
|
||||
}
|
||||
|
||||
public function testUnstartedSessionIsNotSave()
|
||||
{
|
||||
$this->sessionHasNotBeenStarted();
|
||||
@@ -133,10 +163,10 @@ class TestSessionListenerTest extends TestCase
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
private function filterResponse(Request $request, $type = HttpKernelInterface::MASTER_REQUEST)
|
||||
private function filterResponse(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, Response $response = null)
|
||||
{
|
||||
$request->setSession($this->session);
|
||||
$response = new Response();
|
||||
$response = $response ?: new Response();
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
$event = new FilterResponseEvent($kernel, $request, $type, $response);
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\EventListener\ValidateRequestListener;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\EventListener\ValidateRequestListener;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fixtures\_123;
|
||||
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
class Kernel123 extends Kernel
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
class KernelForOverrideName extends Kernel
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
class KernelForTest extends Kernel
|
||||
{
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fragment;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Esi;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\UriSigner;
|
||||
|
||||
class EsiFragmentRendererTest extends TestCase
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fragment;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
|
||||
|
||||
/**
|
||||
* @group time-sensitive
|
||||
@@ -88,7 +88,7 @@ class FragmentHandlerTest extends TestCase
|
||||
;
|
||||
|
||||
if ($arguments) {
|
||||
call_user_func_array(array($e, 'with'), $arguments);
|
||||
\call_user_func_array(array($e, 'with'), $arguments);
|
||||
}
|
||||
|
||||
$handler = new FragmentHandler($this->requestStack);
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fragment;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer;
|
||||
use Symfony\Component\HttpKernel\UriSigner;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class HIncludeFragmentRendererTest extends TestCase
|
||||
{
|
||||
@@ -86,4 +86,17 @@ class HIncludeFragmentRendererTest extends TestCase
|
||||
$strategy = new HIncludeFragmentRenderer($engine);
|
||||
$this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent());
|
||||
}
|
||||
|
||||
public function testRenderWithEngineAndDefaultText()
|
||||
{
|
||||
$engine = $this->getMockBuilder('Symfony\\Component\\Templating\\EngineInterface')->getMock();
|
||||
$engine->expects($this->once())
|
||||
->method('exists')
|
||||
->with('loading...')
|
||||
->will($this->throwException(new \RuntimeException()));
|
||||
|
||||
// only default
|
||||
$strategy = new HIncludeFragmentRenderer($engine);
|
||||
$this->assertEquals('<hx:include src="/foo">loading...</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'loading...'))->getContent());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fragment;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\HttpKernel;
|
||||
use Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer;
|
||||
use Symfony\Component\HttpKernel\HttpKernel;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
|
||||
class InlineFragmentRendererTest extends TestCase
|
||||
{
|
||||
@@ -44,7 +44,9 @@ class InlineFragmentRendererTest extends TestCase
|
||||
$subRequest = Request::create('/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dmain_controller');
|
||||
$subRequest->attributes->replace(array('object' => $object, '_format' => 'html', '_controller' => 'main_controller', '_locale' => 'en'));
|
||||
$subRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
|
||||
$subRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http'));
|
||||
$subRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
|
||||
$subRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http');
|
||||
|
||||
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($subRequest));
|
||||
|
||||
@@ -55,7 +57,11 @@ class InlineFragmentRendererTest extends TestCase
|
||||
{
|
||||
Request::setTrustedProxies(array(), 0);
|
||||
|
||||
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest(Request::create('/')));
|
||||
$expectedSubRequest = Request::create('/');
|
||||
$expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
|
||||
$expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
|
||||
|
||||
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest));
|
||||
$this->assertSame('foo', $strategy->render('/', Request::create('/'))->getContent());
|
||||
|
||||
Request::setTrustedProxies(array(), -1);
|
||||
@@ -148,6 +154,8 @@ class InlineFragmentRendererTest extends TestCase
|
||||
$expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
|
||||
$expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
|
||||
}
|
||||
$expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http'));
|
||||
$expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http');
|
||||
|
||||
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest));
|
||||
|
||||
@@ -158,7 +166,7 @@ class InlineFragmentRendererTest extends TestCase
|
||||
|
||||
public function testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled()
|
||||
{
|
||||
Request::setTrustedProxies(array(), 0);
|
||||
Request::setTrustedProxies(array(), Request::HEADER_FORWARDED);
|
||||
|
||||
$this->testESIHeaderIsKeptInSubrequest();
|
||||
|
||||
@@ -169,7 +177,9 @@ class InlineFragmentRendererTest extends TestCase
|
||||
{
|
||||
$expectedSubRequest = Request::create('/');
|
||||
$expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
|
||||
$expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http'));
|
||||
$expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
|
||||
$expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http');
|
||||
|
||||
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest));
|
||||
$request = Request::create('/', 'GET', array(), array(), array(), array('HTTP_IF_MODIFIED_SINCE' => 'Fri, 01 Jan 2016 00:00:00 GMT', 'HTTP_IF_NONE_MATCH' => '*'));
|
||||
@@ -182,9 +192,32 @@ class InlineFragmentRendererTest extends TestCase
|
||||
|
||||
$expectedSubRequest = Request::create('/');
|
||||
$expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"');
|
||||
$expectedSubRequest->server->set('REMOTE_ADDR', '1.1.1.1');
|
||||
$expectedSubRequest->server->set('REMOTE_ADDR', '127.0.0.1');
|
||||
$expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
|
||||
$expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http'));
|
||||
$expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
|
||||
$expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http');
|
||||
|
||||
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest));
|
||||
|
||||
$request = Request::create('/');
|
||||
$request->headers->set('Surrogate-Capability', 'abc="ESI/1.0"');
|
||||
$strategy->render('/', $request);
|
||||
|
||||
Request::setTrustedProxies(array(), -1);
|
||||
}
|
||||
|
||||
public function testIpAddressOfRangedTrustedProxyIsSetAsRemote()
|
||||
{
|
||||
$expectedSubRequest = Request::create('/');
|
||||
$expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"');
|
||||
$expectedSubRequest->server->set('REMOTE_ADDR', '127.0.0.1');
|
||||
$expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
|
||||
$expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http'));
|
||||
$expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
|
||||
$expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http');
|
||||
|
||||
Request::setTrustedProxies(array('1.1.1.1/24'), -1);
|
||||
|
||||
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest));
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fragment;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\Fragment\SsiFragmentRenderer;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Ssi;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\UriSigner;
|
||||
|
||||
class SsiFragmentRendererTest extends TestCase
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Esi;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Esi;
|
||||
|
||||
class EsiTest extends TestCase
|
||||
{
|
||||
@@ -231,10 +231,10 @@ class EsiTest extends TestCase
|
||||
->method('getRequest')
|
||||
->will($this->returnValue($request))
|
||||
;
|
||||
if (is_array($response)) {
|
||||
if (\is_array($response)) {
|
||||
$cache->expects($this->any())
|
||||
->method('handle')
|
||||
->will(call_user_func_array(array($this, 'onConsecutiveCalls'), $response))
|
||||
->will(\call_user_func_array(array($this, 'onConsecutiveCalls'), $response))
|
||||
;
|
||||
} else {
|
||||
$cache->expects($this->any())
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
|
||||
|
||||
use Symfony\Component\HttpKernel\HttpCache\Esi;
|
||||
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Esi;
|
||||
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Store;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
@@ -215,7 +215,7 @@ class HttpCacheTest extends HttpCacheTestCase
|
||||
if ($request->cookies->has('authenticated')) {
|
||||
$response->headers->set('Cache-Control', 'private, no-store');
|
||||
$response->setETag('"private tag"');
|
||||
if (in_array('"private tag"', $etags)) {
|
||||
if (\in_array('"private tag"', $etags)) {
|
||||
$response->setStatusCode(304);
|
||||
} else {
|
||||
$response->setStatusCode(200);
|
||||
@@ -225,7 +225,7 @@ class HttpCacheTest extends HttpCacheTestCase
|
||||
} else {
|
||||
$response->headers->set('Cache-Control', 'public');
|
||||
$response->setETag('"public tag"');
|
||||
if (in_array('"public tag"', $etags)) {
|
||||
if (\in_array('"public tag"', $etags)) {
|
||||
$response->setStatusCode(304);
|
||||
} else {
|
||||
$response->setStatusCode(200);
|
||||
@@ -566,7 +566,7 @@ class HttpCacheTest extends HttpCacheTestCase
|
||||
|
||||
public function testDegradationWhenCacheLocked()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Skips on windows to avoid permissions issues.');
|
||||
}
|
||||
|
||||
@@ -994,7 +994,7 @@ class HttpCacheTest extends HttpCacheTestCase
|
||||
$this->assertHttpKernelIsNotCalled();
|
||||
$this->assertEquals(200, $this->response->getStatusCode());
|
||||
$this->assertEquals('', $this->response->getContent());
|
||||
$this->assertEquals(strlen('Hello World'), $this->response->headers->get('Content-Length'));
|
||||
$this->assertEquals(\strlen('Hello World'), $this->response->headers->get('Content-Length'));
|
||||
}
|
||||
|
||||
public function testSendsNoContentWhenFresh()
|
||||
@@ -1338,20 +1338,27 @@ class HttpCacheTest extends HttpCacheTestCase
|
||||
$this->setNextResponse();
|
||||
$this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1'));
|
||||
|
||||
$this->assertEquals('127.0.0.1', $this->kernel->getBackendRequest()->server->get('REMOTE_ADDR'));
|
||||
$this->kernel->assert(function ($backendRequest) {
|
||||
$this->assertSame('127.0.0.1', $backendRequest->server->get('REMOTE_ADDR'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getTrustedProxyData
|
||||
*/
|
||||
public function testHttpCacheIsSetAsATrustedProxy(array $existing, array $expected)
|
||||
public function testHttpCacheIsSetAsATrustedProxy(array $existing)
|
||||
{
|
||||
Request::setTrustedProxies($existing, Request::HEADER_X_FORWARDED_ALL);
|
||||
|
||||
$this->setNextResponse();
|
||||
$this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1'));
|
||||
$this->assertSame($existing, Request::getTrustedProxies());
|
||||
|
||||
$this->assertEquals($expected, Request::getTrustedProxies());
|
||||
$existing = array_unique(array_merge($existing, array('127.0.0.1')));
|
||||
$this->kernel->assert(function ($backendRequest) use ($existing) {
|
||||
$this->assertSame($existing, Request::getTrustedProxies());
|
||||
$this->assertsame('10.0.0.1', $backendRequest->getClientIp());
|
||||
});
|
||||
|
||||
Request::setTrustedProxies(array(), -1);
|
||||
}
|
||||
@@ -1359,45 +1366,41 @@ class HttpCacheTest extends HttpCacheTestCase
|
||||
public function getTrustedProxyData()
|
||||
{
|
||||
return array(
|
||||
array(array(), array('127.0.0.1')),
|
||||
array(array('10.0.0.2'), array('10.0.0.2', '127.0.0.1')),
|
||||
array(array('10.0.0.2', '127.0.0.1'), array('10.0.0.2', '127.0.0.1')),
|
||||
array(array()),
|
||||
array(array('10.0.0.2')),
|
||||
array(array('10.0.0.2', '127.0.0.1')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getXForwardedForData
|
||||
* @dataProvider getForwardedData
|
||||
*/
|
||||
public function testXForwarderForHeaderForForwardedRequests($xForwardedFor, $expected)
|
||||
public function testForwarderHeaderForForwardedRequests($forwarded, $expected)
|
||||
{
|
||||
$this->setNextResponse();
|
||||
$server = array('REMOTE_ADDR' => '10.0.0.1');
|
||||
if (false !== $xForwardedFor) {
|
||||
$server['HTTP_X_FORWARDED_FOR'] = $xForwardedFor;
|
||||
if (null !== $forwarded) {
|
||||
Request::setTrustedProxies($server, -1);
|
||||
$server['HTTP_FORWARDED'] = $forwarded;
|
||||
}
|
||||
$this->request('GET', '/', $server);
|
||||
|
||||
$this->assertEquals($expected, $this->kernel->getBackendRequest()->headers->get('X-Forwarded-For'));
|
||||
$this->kernel->assert(function ($backendRequest) use ($expected) {
|
||||
$this->assertSame($expected, $backendRequest->headers->get('Forwarded'));
|
||||
});
|
||||
|
||||
Request::setTrustedProxies(array(), -1);
|
||||
}
|
||||
|
||||
public function getXForwardedForData()
|
||||
public function getForwardedData()
|
||||
{
|
||||
return array(
|
||||
array(false, '10.0.0.1'),
|
||||
array('10.0.0.2', '10.0.0.2, 10.0.0.1'),
|
||||
array('10.0.0.2, 10.0.0.3', '10.0.0.2, 10.0.0.3, 10.0.0.1'),
|
||||
array(null, 'for="10.0.0.1";host="localhost";proto=http'),
|
||||
array('for=10.0.0.2', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.1"'),
|
||||
array('for=10.0.0.2, for=10.0.0.3', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.3", for="10.0.0.1"'),
|
||||
);
|
||||
}
|
||||
|
||||
public function testXForwarderForHeaderForPassRequests()
|
||||
{
|
||||
$this->setNextResponse();
|
||||
$server = array('REMOTE_ADDR' => '10.0.0.1');
|
||||
$this->request('POST', '/', $server);
|
||||
|
||||
$this->assertEquals('10.0.0.1', $this->kernel->getBackendRequest()->headers->get('X-Forwarded-For'));
|
||||
}
|
||||
|
||||
public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponses()
|
||||
{
|
||||
$time = \DateTime::createFromFormat('U', time());
|
||||
|
||||
@@ -168,7 +168,7 @@ class HttpCacheTestCase extends TestCase
|
||||
|
||||
$fp = opendir($directory);
|
||||
while (false !== $file = readdir($fp)) {
|
||||
if (!in_array($file, array('.', '..'))) {
|
||||
if (!\in_array($file, array('.', '..'))) {
|
||||
if (is_link($directory.'/'.$file)) {
|
||||
unlink($directory.'/'.$file);
|
||||
} elseif (is_dir($directory.'/'.$file)) {
|
||||
|
||||
@@ -198,10 +198,10 @@ class SsiTest extends TestCase
|
||||
->method('getRequest')
|
||||
->will($this->returnValue($request))
|
||||
;
|
||||
if (is_array($response)) {
|
||||
if (\is_array($response)) {
|
||||
$cache->expects($this->any())
|
||||
->method('handle')
|
||||
->will(call_user_func_array(array($this, 'onConsecutiveCalls'), $response))
|
||||
->will(\call_user_func_array(array($this, 'onConsecutiveCalls'), $response))
|
||||
;
|
||||
} else {
|
||||
$cache->expects($this->any())
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user