Merge branch '2.0'
* 2.0: [HttpKernel] fixed typo fixed previous merge, done the same change to other occurences fixes usage of mb_* Profiler session import fixed. [Process] workaround a faulty implementation of is_executable on Windows Swedish translation fix. [Locale] Fix #2179 StubIntlDateFormatter support yy format Fixed fourth argument of Filesystem->mirror()
This commit is contained in:
commit
6fa1d64f84
@ -32,7 +32,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="8">
|
||||
<source>One or more of the given values is invalid</source>
|
||||
<target>Ett eller fler av de valda värdena är ogiltigt</target>
|
||||
<target>Ett eller fler av de angivna värdena är ogiltigt</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="9">
|
||||
<source>The fields {{ fields }} were not expected</source>
|
||||
|
@ -101,11 +101,11 @@ class ProfilerController extends ContainerAware
|
||||
$profiler->disable();
|
||||
|
||||
$file = $this->container->get('request')->files->get('file');
|
||||
if (!$file || UPLOAD_ERR_OK !== $file->getError()) {
|
||||
if (empty($file) || UPLOAD_ERR_OK !== $file->getError()) {
|
||||
throw new \RuntimeException('Problem uploading the data.');
|
||||
}
|
||||
|
||||
if (!$profile = $profiler->import(file_get_contents($file->getPath()))) {
|
||||
if (!$profile = $profiler->import(file_get_contents($file->getPathname()))) {
|
||||
throw new \RuntimeException('Problem uploading the data (token already exists).');
|
||||
}
|
||||
|
||||
|
@ -718,9 +718,16 @@ class Application
|
||||
*/
|
||||
public function renderException($e, $output)
|
||||
{
|
||||
$strlen = function ($string)
|
||||
{
|
||||
return function_exists('mb_strlen') ? mb_strlen($string, mb_detect_encoding($string)) : strlen($string);
|
||||
$strlen = function ($string) {
|
||||
if (!function_exists('mb_strlen')) {
|
||||
return strlen($string);
|
||||
}
|
||||
|
||||
if (false === $encoding = mb_detect_encoding($string)) {
|
||||
return strlen($string);
|
||||
}
|
||||
|
||||
return mb_strlen($string, $encoding);
|
||||
};
|
||||
|
||||
do {
|
||||
|
@ -74,7 +74,15 @@ class FormatterHelper extends Helper
|
||||
*/
|
||||
private function strlen($string)
|
||||
{
|
||||
return function_exists('mb_strlen') ? mb_strlen($string, mb_detect_encoding($string)) : strlen($string);
|
||||
if (!function_exists('mb_strlen')) {
|
||||
return strlen($string);
|
||||
}
|
||||
|
||||
if (false === $encoding = mb_detect_encoding($string)) {
|
||||
return strlen($string);
|
||||
}
|
||||
|
||||
return mb_strlen($string, $encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -198,7 +198,7 @@ abstract class PdoProfilerStorage implements ProfilerStorageInterface
|
||||
$profile->setParent($parent);
|
||||
}
|
||||
|
||||
$profile->setChildren($this->readChildren($token, $parent));
|
||||
$profile->setChildren($this->readChildren($token, $profile));
|
||||
|
||||
return $profile;
|
||||
}
|
||||
|
@ -174,14 +174,23 @@ class Filesystem
|
||||
* @param string $originDir The origin directory
|
||||
* @param string $targetDir The target directory
|
||||
* @param \Traversable $iterator A Traversable instance
|
||||
* @param array $options An array of options (see copy())
|
||||
* @param array $options An array of boolean options
|
||||
* Valid options are:
|
||||
* - $options['override'] Whether to override an existing file on copy or not (see copy())
|
||||
* - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink())
|
||||
*
|
||||
* @throws \RuntimeException When file type is unknown
|
||||
*/
|
||||
public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
|
||||
{
|
||||
$copyOnWindows = false;
|
||||
if (isset($options['copy_on_windows']) && !function_exists('symlink')) {
|
||||
$copyOnWindows = $options['copy_on_windows'];
|
||||
}
|
||||
|
||||
if (null === $iterator) {
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
|
||||
$flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
|
||||
}
|
||||
|
||||
if ('/' === substr($targetDir, -1) || '\\' === substr($targetDir, -1)) {
|
||||
@ -197,8 +206,8 @@ class Filesystem
|
||||
|
||||
if (is_dir($file)) {
|
||||
$this->mkdir($target);
|
||||
} else if (is_file($file)) {
|
||||
$this->copy($file, $target, $options);
|
||||
} else if (is_file($file) || ($copyOnWindows && is_link($file))) {
|
||||
$this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
|
||||
} else if (is_link($file)) {
|
||||
$this->symlink($file, $target);
|
||||
} else {
|
||||
|
@ -294,6 +294,13 @@ class FullTransformer
|
||||
$dateTime->setTimezone(new \DateTimeZone($timezone));
|
||||
}
|
||||
|
||||
// Normalize yy year
|
||||
preg_match_all($this->regExp, $this->pattern, $matches);
|
||||
if (in_array('yy', $matches[0])) {
|
||||
$dateTime->setTimestamp(time());
|
||||
$year = $year > $dateTime->format('y') + 20 ? 1900 + $year : 2000 + $year;
|
||||
}
|
||||
|
||||
$dateTime->setDate($year, $month, $day);
|
||||
$dateTime->setTime($hour, $minute, $second);
|
||||
|
||||
|
@ -19,8 +19,17 @@ namespace Symfony\Component\Process;
|
||||
*/
|
||||
class ExecutableFinder
|
||||
{
|
||||
private static $isWindows;
|
||||
|
||||
private $suffixes = array('.exe', '.bat', '.cmd', '.com');
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if (null === self::$isWindows) {
|
||||
self::$isWindows = 0 === stripos(PHP_OS, 'win');
|
||||
}
|
||||
}
|
||||
|
||||
public function setSuffixes(array $suffixes)
|
||||
{
|
||||
$this->suffixes = $suffixes;
|
||||
@ -61,7 +70,7 @@ class ExecutableFinder
|
||||
$suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : $this->suffixes) : array('');
|
||||
foreach ($suffixes as $suffix) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && is_executable($file)) {
|
||||
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && (self::$isWindows || is_executable($file))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
@ -544,8 +544,7 @@ class StubIntlDateFormatterTest extends LocaleTestCase
|
||||
return array(
|
||||
// years
|
||||
array('y-M-d', '1970-1-1', 0),
|
||||
// TODO: review to support or not this variant
|
||||
// array('yy-M-d', '70-1-1', 0),
|
||||
array('yy-M-d', '70-1-1', 0),
|
||||
|
||||
// months
|
||||
array('y-M-d', '1970-1-1', 0),
|
||||
|
Reference in New Issue
Block a user