Merge branch '2.0' into 2.1
* 2.0: [Bundle] [FrameworkBundle] fixed indentation in esi.xml services file. [TwigBundle] There is no CSS visibility of display, should be visible instead [DependencyInjection] fixed a bug where the strict flag on references were lost (closes #6607) [HttpFoundation] Check if required shell functions for `FileBinaryMimeTypeGuesser` are not disabled [CssSelector] added css selector with empty string [HttpFoundation] Docblock for Request::isXmlHttpRequest() now points to Wikipedia [DependencyInjection] refactored code to avoid logic duplication Conflicts: src/Symfony/Bundle/FrameworkBundle/Resources/config/esi.xml src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php
This commit is contained in:
commit
8321127cda
@ -13,8 +13,8 @@
|
|||||||
<service id="esi" class="%esi.class%" />
|
<service id="esi" class="%esi.class%" />
|
||||||
|
|
||||||
<service id="esi_listener" class="%esi_listener.class%">
|
<service id="esi_listener" class="%esi_listener.class%">
|
||||||
<tag name="kernel.event_subscriber" />
|
<tag name="kernel.event_subscriber" />
|
||||||
<argument type="service" id="esi" on-invalid="ignore" />
|
<argument type="service" id="esi" on-invalid="ignore" />
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
in {{ trace.file|format_file(trace.line) }}
|
in {{ trace.file|format_file(trace.line) }}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
<a href="#" onclick="toggle('trace_{{ prefix ~ '_' ~ i }}'); switchIcons('icon_{{ prefix ~ '_' ~ i }}_open', 'icon_{{ prefix ~ '_' ~ i }}_close'); return false;">
|
<a href="#" onclick="toggle('trace_{{ prefix ~ '_' ~ i }}'); switchIcons('icon_{{ prefix ~ '_' ~ i }}_open', 'icon_{{ prefix ~ '_' ~ i }}_close'); return false;">
|
||||||
<img class="toggle" id="icon_{{ prefix ~ '_' ~ i }}_close" alt="-" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}" style="visibility: {{ 0 == i ? 'display' : 'hidden' }}" />
|
<img class="toggle" id="icon_{{ prefix ~ '_' ~ i }}_close" alt="-" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}" style="visibility: {{ 0 == i ? 'visible' : 'hidden' }}" />
|
||||||
<img class="toggle" id="icon_{{ prefix ~ '_' ~ i }}_open" alt="+" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}" style="visibility: {{ 0 == i ? 'hidden' : 'display' }}; margin-left: -18px" />
|
<img class="toggle" id="icon_{{ prefix ~ '_' ~ i }}_open" alt="+" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}" style="visibility: {{ 0 == i ? 'hidden' : 'visible' }}; margin-left: -18px" />
|
||||||
</a>
|
</a>
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
<div id="trace_{{ prefix ~ '_' ~ i }}" style="display: {{ 0 == i ? 'block' : 'none' }}" class="trace">
|
<div id="trace_{{ prefix ~ '_' ~ i }}" style="display: {{ 0 == i ? 'block' : 'none' }}" class="trace">
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
{{ exception.class|abbr_class }}: {{ exception.message|nl2br|format_file_from_text }}
|
{{ exception.class|abbr_class }}: {{ exception.message|nl2br|format_file_from_text }}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
<a href="#" onclick="toggle('traces_{{ position }}', 'traces'); switchIcons('icon_traces_{{ position }}_open', 'icon_traces_{{ position }}_close'); return false;">
|
<a href="#" onclick="toggle('traces_{{ position }}', 'traces'); switchIcons('icon_traces_{{ position }}_open', 'icon_traces_{{ position }}_close'); return false;">
|
||||||
<img class="toggle" id="icon_traces_{{ position }}_close" alt="-" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}" style="visibility: {{ 0 == count ? 'display' : 'hidden' }}" />
|
<img class="toggle" id="icon_traces_{{ position }}_close" alt="-" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}" style="visibility: {{ 0 == count ? 'visible' : 'hidden' }}" />
|
||||||
<img class="toggle" id="icon_traces_{{ position }}_open" alt="+" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}" style="visibility: {{ 0 == count ? 'hidden' : 'display' }}; margin-left: -18px" />
|
<img class="toggle" id="icon_traces_{{ position }}_open" alt="+" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}" style="visibility: {{ 0 == count ? 'hidden' : 'visible' }}; margin-left: -18px" />
|
||||||
</a>
|
</a>
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -34,6 +34,7 @@ class TokenizerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$this->assertEquals('foo[class=foo bar ]', $this->tokensToString($this->tokenizer->tokenize('foo[class="foo bar"]')), '->tokenize() lexes an input string and returns an array of tokens');
|
$this->assertEquals('foo[class=foo bar ]', $this->tokensToString($this->tokenizer->tokenize('foo[class="foo bar"]')), '->tokenize() lexes an input string and returns an array of tokens');
|
||||||
$this->assertEquals("foo[class=foo Abar ]", $this->tokensToString($this->tokenizer->tokenize('foo[class="foo \\65 bar"]')), '->tokenize() lexes an input string and returns an array of tokens');
|
$this->assertEquals("foo[class=foo Abar ]", $this->tokensToString($this->tokenizer->tokenize('foo[class="foo \\65 bar"]')), '->tokenize() lexes an input string and returns an array of tokens');
|
||||||
|
$this->assertEquals("img[alt= ]", $this->tokensToString($this->tokenizer->tokenize('img[alt=""]')), '->tokenize() lexes an input string and returns an array of tokens');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,7 +129,7 @@ class Tokenizer
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = substr($s, $start, $next - $start);
|
$result = substr($s, $start, $next - $start);
|
||||||
if ('\\' === $result[strlen($result) - 1]) {
|
if (strlen($result) > 0 && '\\' === $result[strlen($result) - 1]) {
|
||||||
// next quote character is escaped
|
// next quote character is escaped
|
||||||
$pos = $next + 1;
|
$pos = $next + 1;
|
||||||
continue;
|
continue;
|
||||||
|
@ -89,7 +89,7 @@ class ResolveInvalidReferencesPass implements CompilerPassInterface
|
|||||||
|
|
||||||
// resolve invalid behavior
|
// resolve invalid behavior
|
||||||
if ($exists && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
|
if ($exists && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
|
||||||
$arguments[$k] = new Reference($id);
|
$arguments[$k] = new Reference($id, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $argument->isStrict());
|
||||||
} elseif (!$exists && ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) {
|
} elseif (!$exists && ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) {
|
||||||
$arguments[$k] = null;
|
$arguments[$k] = null;
|
||||||
} elseif (!$exists && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) {
|
} elseif (!$exists && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) {
|
||||||
|
@ -229,24 +229,7 @@ class PhpDumper extends Dumper
|
|||||||
throw new ServiceCircularReferenceException($id, array($id));
|
throw new ServiceCircularReferenceException($id, array($id));
|
||||||
}
|
}
|
||||||
|
|
||||||
$arguments = array();
|
$code .= $this->addNewInstance($id, $sDefinition, '$'.$name, ' = ');
|
||||||
foreach ($sDefinition->getArguments() as $argument) {
|
|
||||||
$arguments[] = $this->dumpValue($argument);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $sDefinition->getFactoryMethod()) {
|
|
||||||
if (null !== $sDefinition->getFactoryClass()) {
|
|
||||||
$code .= sprintf(" \$%s = call_user_func(array(%s, '%s')%s);\n", $name, $this->dumpValue($sDefinition->getFactoryClass()), $sDefinition->getFactoryMethod(), count($arguments) > 0 ? ', '.implode(', ', $arguments) : '');
|
|
||||||
} elseif (null !== $sDefinition->getFactoryService()) {
|
|
||||||
$code .= sprintf(" \$%s = %s->%s(%s);\n", $name, $this->getServiceCall($sDefinition->getFactoryService()), $sDefinition->getFactoryMethod(), implode(', ', $arguments));
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException('Factory service or factory class must be defined in service definition for '.$id);
|
|
||||||
}
|
|
||||||
} elseif (false !== strpos($class, '$')) {
|
|
||||||
$code .= sprintf(" \$class = %s;\n \$%s = new \$class(%s);\n", $class, $name, implode(', ', $arguments));
|
|
||||||
} else {
|
|
||||||
$code .= sprintf(" \$%s = new \\%s(%s);\n", $name, substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->hasReference($id, $sDefinition->getMethodCalls(), true) && !$this->hasReference($id, $sDefinition->getProperties(), true)) {
|
if (!$this->hasReference($id, $sDefinition->getMethodCalls(), true) && !$this->hasReference($id, $sDefinition->getProperties(), true)) {
|
||||||
$code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
|
$code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
|
||||||
@ -297,11 +280,6 @@ class PhpDumper extends Dumper
|
|||||||
throw new InvalidArgumentException(sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id));
|
throw new InvalidArgumentException(sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id));
|
||||||
}
|
}
|
||||||
|
|
||||||
$arguments = array();
|
|
||||||
foreach ($definition->getArguments() as $value) {
|
|
||||||
$arguments[] = $this->dumpValue($value);
|
|
||||||
}
|
|
||||||
|
|
||||||
$simple = $this->isSimpleInstance($id, $definition);
|
$simple = $this->isSimpleInstance($id, $definition);
|
||||||
|
|
||||||
$instantiation = '';
|
$instantiation = '';
|
||||||
@ -320,19 +298,7 @@ class PhpDumper extends Dumper
|
|||||||
$instantiation .= ' = ';
|
$instantiation .= ' = ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $definition->getFactoryMethod()) {
|
$code = $this->addNewInstance($id, $definition, $return, $instantiation);
|
||||||
if (null !== $definition->getFactoryClass()) {
|
|
||||||
$code = sprintf(" $return{$instantiation}call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($definition->getFactoryClass()), $definition->getFactoryMethod(), $arguments ? ', '.implode(', ', $arguments) : '');
|
|
||||||
} elseif (null !== $definition->getFactoryService()) {
|
|
||||||
$code = sprintf(" $return{$instantiation}%s->%s(%s);\n", $this->getServiceCall($definition->getFactoryService()), $definition->getFactoryMethod(), implode(', ', $arguments));
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException('Factory method requires a factory service or factory class in service definition for '.$id);
|
|
||||||
}
|
|
||||||
} elseif (false !== strpos($class, '$')) {
|
|
||||||
$code = sprintf(" \$class = %s;\n\n $return{$instantiation}new \$class(%s);\n", $class, implode(', ', $arguments));
|
|
||||||
} else {
|
|
||||||
$code = sprintf(" $return{$instantiation}new \\%s(%s);\n", substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$simple) {
|
if (!$simple) {
|
||||||
$code .= "\n";
|
$code .= "\n";
|
||||||
@ -611,6 +577,34 @@ EOF;
|
|||||||
return $publicServices.$aliasServices.$privateServices;
|
return $publicServices.$aliasServices.$privateServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function addNewInstance($id, Definition $definition, $return, $instantiation)
|
||||||
|
{
|
||||||
|
$class = $this->dumpValue($definition->getClass());
|
||||||
|
|
||||||
|
$arguments = array();
|
||||||
|
foreach ($definition->getArguments() as $value) {
|
||||||
|
$arguments[] = $this->dumpValue($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $definition->getFactoryMethod()) {
|
||||||
|
if (null !== $definition->getFactoryClass()) {
|
||||||
|
return sprintf(" $return{$instantiation}call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($definition->getFactoryClass()), $definition->getFactoryMethod(), $arguments ? ', '.implode(', ', $arguments) : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $definition->getFactoryService()) {
|
||||||
|
return sprintf(" $return{$instantiation}%s->%s(%s);\n", $this->getServiceCall($definition->getFactoryService()), $definition->getFactoryMethod(), implode(', ', $arguments));
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new RuntimeException('Factory method requires a factory service or factory class in service definition for '.$id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false !== strpos($class, '$')) {
|
||||||
|
return sprintf(" \$class = %s;\n\n $return{$instantiation}new \$class(%s);\n", $class, implode(', ', $arguments));
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf(" $return{$instantiation}new \\%s(%s);\n", substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the class headers.
|
* Adds the class headers.
|
||||||
*
|
*
|
||||||
|
@ -61,6 +61,20 @@ class ResolveInvalidReferencesPassTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(array(), $def->getProperties());
|
$this->assertEquals(array(), $def->getProperties());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testStrictFlagIsPreserved()
|
||||||
|
{
|
||||||
|
$container = new ContainerBuilder();
|
||||||
|
$container->register('bar');
|
||||||
|
$def = $container
|
||||||
|
->register('foo')
|
||||||
|
->addArgument(new Reference('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE, false))
|
||||||
|
;
|
||||||
|
|
||||||
|
$this->process($container);
|
||||||
|
|
||||||
|
$this->assertFalse($def->getArgument(0)->isStrict());
|
||||||
|
}
|
||||||
|
|
||||||
protected function process(ContainerBuilder $container)
|
protected function process(ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
$pass = new ResolveInvalidReferencesPass();
|
$pass = new ResolveInvalidReferencesPass();
|
||||||
|
@ -45,7 +45,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
|
|||||||
*/
|
*/
|
||||||
public static function isSupported()
|
public static function isSupported()
|
||||||
{
|
{
|
||||||
return !defined('PHP_WINDOWS_VERSION_BUILD');
|
return !defined('PHP_WINDOWS_VERSION_BUILD') && function_exists('passthru') && function_exists('escapeshellarg');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1358,7 +1358,8 @@ class Request
|
|||||||
* Returns true if the request is a XMLHttpRequest.
|
* Returns true if the request is a XMLHttpRequest.
|
||||||
*
|
*
|
||||||
* It works if your JavaScript library set an X-Requested-With HTTP header.
|
* It works if your JavaScript library set an X-Requested-With HTTP header.
|
||||||
* It is known to work with Prototype, Mootools, jQuery.
|
* It is known to work with common JavaScript frameworks:
|
||||||
|
* @link http://en.wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScript
|
||||||
*
|
*
|
||||||
* @return Boolean true if the request is an XMLHttpRequest, false otherwise
|
* @return Boolean true if the request is an XMLHttpRequest, false otherwise
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user