Skip to content

Commit

Permalink
merged 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Apr 25, 2012
2 parents 66090ff + bd11281 commit 76ef8da
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 23 deletions.
1 change: 0 additions & 1 deletion composer.json
Expand Up @@ -17,7 +17,6 @@
],
"require": {
"php": ">=5.3.2",
"doctrine/common": "2.2.*",
"twig/twig": ">=1.1,<2.0-dev"
},
"replace": {
Expand Down
Expand Up @@ -17,6 +17,7 @@
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;
Expand Down Expand Up @@ -544,13 +545,17 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder

// Register translation resources
if ($dirs) {
foreach ($dirs as $dir) {
$container->addResource(new DirectoryResource($dir));
}
$finder = Finder::create()
->files()
->filter(function (\SplFileInfo $file) {
return 2 === substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename());
})
->in($dirs)
;

foreach ($finder as $file) {
// filename is domain.locale.format
list($domain, $locale, $format) = explode('.', $file->getBasename(), 3);
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/HttpKernel.php
Expand Up @@ -208,14 +208,14 @@ public function generateInternalUri($controller, array $attributes = array(), ar
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;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php
Expand Up @@ -84,6 +84,8 @@ public function __construct($prefix)
* 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)
{
Expand Down
Expand Up @@ -172,7 +172,7 @@ static public function fixNamespaceDeclarations($source)
/**
* 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
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/ClassLoader/UniversalClassLoader.php
Expand Up @@ -216,8 +216,8 @@ public function registerPrefixes(array $classes)
/**
* 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
*/
Expand Down
32 changes: 27 additions & 5 deletions src/Symfony/Component/DomCrawler/Crawler.php
Expand Up @@ -543,7 +543,7 @@ public function filter($selector)
/**
* 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
*
Expand All @@ -560,7 +560,7 @@ public function selectLink($value)
/**
* 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
*
Expand All @@ -578,7 +578,7 @@ public function selectButton($value)
/**
* 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
*
Expand Down Expand Up @@ -617,8 +617,8 @@ public function links()
/**
* 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
*
Expand All @@ -641,6 +641,28 @@ public function form(array $values = null, $method = null)
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, "'")) {
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/DomCrawler/Form.php
Expand Up @@ -142,7 +142,7 @@ public function getFiles()
*/
public function getPhpValues()
{
$qs = http_build_query($this->getValues());
$qs = http_build_query($this->getValues(), '', '&');
parse_str($qs, $values);

return $values;
Expand All @@ -160,7 +160,7 @@ public function getPhpValues()
*/
public function getPhpFiles()
{
$qs = http_build_query($this->getFiles());
$qs = http_build_query($this->getFiles(), '', '&');
parse_str($qs, $values);

return $values;
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpFoundation/Request.php
Expand Up @@ -659,9 +659,9 @@ public function getPort()
{
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');
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpKernel/HttpCache/Store.php
Expand Up @@ -167,7 +167,7 @@ public function write(Request $request, Response $response)
$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('');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Routing/Generator/UrlGenerator.php
Expand Up @@ -135,7 +135,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa

// 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;
}

Expand Down
9 changes: 5 additions & 4 deletions src/Symfony/Component/Validator/README.md
Expand Up @@ -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(
Expand All @@ -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),
));

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Yaml/Tests/ParserTest.php
Expand Up @@ -118,8 +118,8 @@ public function testObjectsSupport()

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;
}
Expand Down

0 comments on commit 76ef8da

Please sign in to comment.