merged 2.0
This commit is contained in:
commit
76ef8da030
|
@ -17,7 +17,6 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"doctrine/common": "2.2.*",
|
||||
"twig/twig": ">=1.1,<2.0-dev"
|
||||
},
|
||||
"replace": {
|
||||
|
|
|
@ -17,6 +17,7 @@ use Symfony\Component\DependencyInjection\DefinitionDecorator;
|
|||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
@ -544,6 +545,9 @@ class FrameworkExtension extends Extension
|
|||
|
||||
// Register translation resources
|
||||
if ($dirs) {
|
||||
foreach ($dirs as $dir) {
|
||||
$container->addResource(new DirectoryResource($dir));
|
||||
}
|
||||
$finder = Finder::create()
|
||||
->files()
|
||||
->filter(function (\SplFileInfo $file) {
|
||||
|
@ -551,6 +555,7 @@ class FrameworkExtension extends Extension
|
|||
})
|
||||
->in($dirs)
|
||||
;
|
||||
|
||||
foreach ($finder as $file) {
|
||||
// filename is domain.locale.format
|
||||
list($domain, $locale, $format) = explode('.', $file->getBasename(), 3);
|
||||
|
|
|
@ -208,14 +208,14 @@ class HttpKernel extends BaseHttpKernel
|
|||
return $controller;
|
||||
}
|
||||
|
||||
$path = http_build_query($attributes);
|
||||
$path = http_build_query($attributes, '', '&');
|
||||
$uri = $this->container->get('router')->generate($secure ? '_internal' : '_internal_public', array(
|
||||
'controller' => $controller,
|
||||
'path' => $path ?: 'none',
|
||||
'_format' => $this->container->get('request')->getRequestFormat(),
|
||||
));
|
||||
|
||||
if ($queryString = http_build_query($query)) {
|
||||
if ($queryString = http_build_query($query, '', '&')) {
|
||||
$uri .= '?'.$queryString;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,8 @@ class ApcUniversalClassLoader extends UniversalClassLoader
|
|||
* Finds a file by class name while caching lookups to APC.
|
||||
*
|
||||
* @param string $class A class name to resolve to file
|
||||
*
|
||||
* @return string|null The path, if found
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
|
|
|
@ -172,7 +172,7 @@ class ClassCollectionLoader
|
|||
/**
|
||||
* Writes a cache file.
|
||||
*
|
||||
* @param string $file Filename
|
||||
* @param string $file Filename
|
||||
* @param string $content Temporary file content
|
||||
*
|
||||
* @throws \RuntimeException when a cache file cannot be written
|
||||
|
|
|
@ -216,8 +216,8 @@ class UniversalClassLoader
|
|||
/**
|
||||
* Registers a set of classes using the PEAR naming convention.
|
||||
*
|
||||
* @param string $prefix The classes prefix
|
||||
* @param array|string $paths The location(s) of the classes
|
||||
* @param string $prefix The classes prefix
|
||||
* @param array|string $paths The location(s) of the classes
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
|
|
|
@ -543,7 +543,7 @@ class Crawler extends \SplObjectStorage
|
|||
/**
|
||||
* Selects links by name or alt value for clickable images.
|
||||
*
|
||||
* @param string $value The link text
|
||||
* @param string $value The link text
|
||||
*
|
||||
* @return Crawler A new instance of Crawler with the filtered list of nodes
|
||||
*
|
||||
|
@ -560,7 +560,7 @@ class Crawler extends \SplObjectStorage
|
|||
/**
|
||||
* Selects a button by name or alt value for images.
|
||||
*
|
||||
* @param string $value The button text
|
||||
* @param string $value The button text
|
||||
*
|
||||
* @return Crawler A new instance of Crawler with the filtered list of nodes
|
||||
*
|
||||
|
@ -578,7 +578,7 @@ class Crawler extends \SplObjectStorage
|
|||
/**
|
||||
* Returns a Link object for the first node in the list.
|
||||
*
|
||||
* @param string $method The method for the link (get by default)
|
||||
* @param string $method The method for the link (get by default)
|
||||
*
|
||||
* @return Link A Link instance
|
||||
*
|
||||
|
@ -617,8 +617,8 @@ class Crawler extends \SplObjectStorage
|
|||
/**
|
||||
* Returns a Form object for the first node in the list.
|
||||
*
|
||||
* @param array $values An array of values for the form fields
|
||||
* @param string $method The method for the form
|
||||
* @param array $values An array of values for the form fields
|
||||
* @param string $method The method for the form
|
||||
*
|
||||
* @return Form A Form instance
|
||||
*
|
||||
|
@ -641,6 +641,28 @@ class Crawler extends \SplObjectStorage
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts string for XPath expressions.
|
||||
*
|
||||
* Escaped characters are: quotes (") and apostrophe (').
|
||||
*
|
||||
* Examples:
|
||||
* <code>
|
||||
* echo Crawler::xpathLiteral('foo " bar');
|
||||
* //prints 'foo " bar'
|
||||
*
|
||||
* echo Crawler::xpathLiteral("foo ' bar");
|
||||
* //prints "foo ' bar"
|
||||
*
|
||||
* echo Crawler::xpathLiteral('a\'b"c');
|
||||
* //prints concat('a', "'", 'b"c')
|
||||
* </code>
|
||||
*
|
||||
* @param string $s String to be escaped
|
||||
*
|
||||
* @return string Converted string
|
||||
*
|
||||
*/
|
||||
static public function xpathLiteral($s)
|
||||
{
|
||||
if (false === strpos($s, "'")) {
|
||||
|
|
|
@ -142,7 +142,7 @@ class Form extends Link implements \ArrayAccess
|
|||
*/
|
||||
public function getPhpValues()
|
||||
{
|
||||
$qs = http_build_query($this->getValues());
|
||||
$qs = http_build_query($this->getValues(), '', '&');
|
||||
parse_str($qs, $values);
|
||||
|
||||
return $values;
|
||||
|
@ -160,7 +160,7 @@ class Form extends Link implements \ArrayAccess
|
|||
*/
|
||||
public function getPhpFiles()
|
||||
{
|
||||
$qs = http_build_query($this->getFiles());
|
||||
$qs = http_build_query($this->getFiles(), '', '&');
|
||||
parse_str($qs, $values);
|
||||
|
||||
return $values;
|
||||
|
|
|
@ -659,9 +659,9 @@ class Request
|
|||
{
|
||||
if (self::$trustProxy && $this->headers->has('X-Forwarded-Port')) {
|
||||
return $this->headers->get('X-Forwarded-Port');
|
||||
} else {
|
||||
return $this->server->get('SERVER_PORT');
|
||||
}
|
||||
|
||||
return $this->server->get('SERVER_PORT');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,6 +26,8 @@ class ErrorHandler
|
|||
E_USER_NOTICE => 'User Notice',
|
||||
E_STRICT => 'Runtime Notice',
|
||||
E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
|
||||
E_DEPRECATED => 'Deprecated',
|
||||
E_USER_DEPRECATED => 'User Deprecated',
|
||||
);
|
||||
|
||||
private $level;
|
||||
|
|
|
@ -167,7 +167,7 @@ class Store implements StoreInterface
|
|||
$entries = array();
|
||||
$vary = $response->headers->get('vary');
|
||||
foreach ($this->getMetadata($key) as $entry) {
|
||||
if (!isset($entry[1]['vary'])) {
|
||||
if (!isset($entry[1]['vary'][0])) {
|
||||
$entry[1]['vary'] = array('');
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ class UrlGenerator implements UrlGeneratorInterface
|
|||
|
||||
// add a query string if needed
|
||||
$extra = array_diff_key($originParameters, $variables, $defaults);
|
||||
if ($extra && $query = http_build_query($extra)) {
|
||||
if ($extra && $query = http_build_query($extra, '', '&')) {
|
||||
$url .= '?'.$query;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ annotations, which can then be checked against instances of these classes.
|
|||
use Symfony\Component\Validator\Validator;
|
||||
use Symfony\Component\Validator\Mapping\ClassMetadataFactory;
|
||||
use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Validator\ConstraintValidatorFactory;
|
||||
|
||||
$validator = new Validator(
|
||||
|
@ -20,10 +21,10 @@ annotations, which can then be checked against instances of these classes.
|
|||
'first_name' => new Assert\MinLength(101),
|
||||
'last_name' => new Assert\MinLength(1),
|
||||
)),
|
||||
'email' => new Assert\Email(),
|
||||
'simple' => new Assert\MinLength(102),
|
||||
'gender' => new Assert\Choice(array(3, 4)),
|
||||
'file' => new Assert\File(),
|
||||
'email' => new Assert\Email(),
|
||||
'simple' => new Assert\MinLength(102),
|
||||
'gender' => new Assert\Choice(array(3, 4)),
|
||||
'file' => new Assert\File(),
|
||||
'password' => new Assert\MinLength(60),
|
||||
));
|
||||
|
||||
|
|
|
@ -118,8 +118,8 @@ EOF
|
|||
|
||||
public function testNonUtf8Exception()
|
||||
{
|
||||
if (!function_exists('mb_detect_encoding')) {
|
||||
$this->markTestSkipped('Exceptions for non-utf8 charsets require the mb_detect_encoding() function.');
|
||||
if (!function_exists('mb_detect_encoding') || !function_exists('iconv')) {
|
||||
$this->markTestSkipped('Exceptions for non-utf8 charsets require the mb_detect_encoding() and iconv() functions.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Reference in New Issue