8000 Merge branch '3.0' · symfony/symfony@86eee06 · GitHub
[go: up one dir, main page]

Skip to content

Commit 86eee06

Browse files
committed
Merge branch '3.0'
* 3.0: [ci] Get ICU/intl from github instead of nebm.ist.utl.pt/~glopes [Debug] Fix case sensitivity checks [Debug] Fix handling of php7 throwables fix high deps tests fix testing deprecation messages [Process] remove dead code [WebProfilerBundle] Add missing use statement. [ClassLoader] Fix storing not-found classes in APC cache [Form] cs fixes in date types [phpunit] disable prophecy
2 parents 850f218 + 4e17cb2 commit 86eee06

File tree

11 files changed

+43
-42
lines changed

11 files changed

+43
-42
lines changed

phpunit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
5151
$zip->extractTo(getcwd());
5252
$zip->close();
5353
chdir("phpunit-$PHPUNIT_VERSION");
54+
passthru("$COMPOSER remove --no-update phpspec/prophecy");
5455
passthru("$COMPOSER remove --no-update symfony/yaml");
5556
passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=3.1@dev\"");
5657
passthru("$COMPOSER install --prefer-dist --no-progress --ansi", $exit);

src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\WebProfilerBundle\Controller;
1313

14+
use Symfony\Component\HttpFoundation\Request;
1415
use Symfony\Component\HttpFoundation\Response;
1516
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
1617
use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;

src/Symfony/Component/ClassLoader/ApcClassLoader.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ public function loadClass($class)
122122
*/
123123
public function findFile($class)
124124
{
125-
if (false === $file = apcu_fetch($this->prefix.$class)) {
126-
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class));
125+
$file = apcu_fetch($this->prefix.$class, $success);
126+
127+
if (!$success) {
128+
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null);
127129
}
128130

129131
return $file;

src/Symfony/Component/ClassLoader/WinCacheClassLoader.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ public function loadClass($class)
121121
*/
122122
public function findFile($class)
123123
{
124-
if (false === $file = wincache_ucache_get($this->prefix.$class)) {
125-
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class), 0);
124+
$file = wincache_ucache_get($this->prefix.$class, $success);
125+
126+
if (!$success) {
127+
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null, 0);
126128
}
127129

128130
return $file;

src/Symfony/Component/ClassLoader/XcacheClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function findFile($class)
124124
if (xcache_isset($this->prefix.$class)) {
125125
$file = xcache_get($this->prefix.$class);
126126
} else {
127-
$file = $this->decorated->findFile($class);
127+
$file = $this->decorated->findFile($class) ?: null;
128128
xcache_set($this->prefix.$class, $file);
129129
}
130130

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,25 @@ public function __construct(callable $classLoader)
4242
$this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
4343

4444
if (!isset(self::$caseCheck)) {
45-
if(!file_exists(strtolower(__FILE__))) {
45+
$file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
46+
$i = strrpos($file, DIRECTORY_SEPARATOR);
47+
$dir = substr($file, 0, 1 + $i);
48+
$file = substr($file, 1 + $i);
49+
$test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
50+
$test = realpath($dir.$test);
51+
52+
if (false === $test || false === $i) {
4653
// filesystem is case sensitive
4754
self::$caseCheck = 0;
48-
} elseif(realpath(strtolower(__FILE__)) === __FILE__) {
49-
// filesystem is not case sensitive
55+
} elseif (substr($test, -strlen($file)) === $file) {
56+
// filesystem is case insensitive and realpath() normalizes the case of characters
5057
self::$caseCheck = 1;
51-
} else {
52-
// filesystem is not case sensitive AND realpath() fails to normalize case
58+
} elseif (false !== stripos(PHP_OS, 'darwin')) {
59+
// on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters
5360
self::$caseCheck = 2;
61+
} else {
62+
// filesystem case checks failed, fallback to disabling them
63+
self::$caseCheck = 0;
5464
}
5565
}
5666
}

src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,28 @@ public function testDefinitions()
6060

6161
public function testCreateDeprecatedService()
6262
{
63-
$definition = new Definition('stdClass');
64-
$definition->setDeprecated(true);
63+
$deprecations = array();
64+
set_error_handler(function ($type, $msg) use (&$deprecations) {
65+
if (E_USER_DEPRECATED !== $type) {
66+
restore_error_handler();
6567

66-
$that = $this;
67-
$wasTriggered = false;
68+
return call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', func_get_args());
69+
}
6870

69-
set_error_handler(function ($errno, $errstr) use ($that, &$wasTriggered) {
70-
$that->assertSame(E_USER_DEPRECATED, $errno);
71-
$that->assertSame('The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.', $errstr);
72-
$wasTriggered = true;
71+
$deprecations[] = $msg;
7372
});
7473

74+
$definition = new Definition('stdClass');
75+
$definition->setDeprecated(true);
76+
7577
$builder = new ContainerBuilder();
7678
$builder->setDefinition('deprecated_foo', $definition);
7779
$builder->get('deprecated_foo');
7880

7981
restore_error_handler();
8082

81-
$this->assertTrue($wasTriggered);
83+
$this->assertCount(1, $deprecations);
84+
$this->assertContains('The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.', $deprecations[0]);
8285
}
8386

8487
public function testRegister()

src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
203203
public function configureOptions(OptionsResolver $resolver)
204204
{
205205
$compound = function (Options $options) {
206-
return $options['widget'] !== 'single_text';
206+
return 'single_text' !== $options['widget'];
207207
};
208208

209209
// Defaults to the value of "widget"

src/Symfony/Component/Form/Extension/Core/Type/DateType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
8383
$pattern
8484
);
8585

86-
// new \intlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/bug.php?id=66323
86+
// new \IntlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/bug.php?id=66323
8787
if (!$formatter) {
8888
throw new InvalidOptionsException(intl_get_error_message(), intl_get_error_code());
8989
}
@@ -180,7 +180,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)
180180
public function configureOptions(OptionsResolver $resolver)
181181
{
182182
$compound = function (Options $options) {
183-
return $options['widget'] !== 'single_text';
183+
return 'single_text' !== $options['widget'];
184184
};
185185

186186
$placeholderDefault = function (Options $options) {
@@ -222,7 +222,7 @@ public function configureOptions(OptionsResolver $resolver)
222222
};
223223

224224
$format = function (Options $options) {
225-
return $options['widget'] === 'single_text' ? DateType::HTML5_FORMAT : DateType::DEFAULT_FORMAT;
225+
return 'single_text' === $options['widget'] ? DateType::HTML5_FORMAT : DateType::DEFAULT_FORMAT;
226226
};
227227

228228
$resolver->setDefaults(array(

src/Symfony/Component/Form/Extension/Core/Type/TimeType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
168168
public function configureOptions(OptionsResolver $resolver)
169169
{
170170
$compound = function (Options $options) {
171-
return $options['widget'] !== 'single_text';
171+
return 'single_text' !== $options['widget'];
172172
};
173173

174174
$placeholderDefault = function (Options $options) {

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,24 +1156,6 @@ public function provideVariousIncrementals() {
11561156
);
11571157
}
11581158

1159-
/**
1160-
* provides default method names for simple getter/setter.
1161-
*/
1162-
public function methodProvider()
1163-
{
1164-
$defaults = array(
1165-
array('CommandLine'),
1166-
array('Timeout'),
1167-
array('WorkingDirectory'),
1168-
array('Env'),
1169-
array('Stdin'),
1170-
array('Input'),
1171-
array('Options'),
1172-
);
1173-
1174-
return $defaults;
1175-
}
1176-
11771159
/**
11781160
* @param string $commandline
11791161
* @param null|string $cwd

0 commit comments

Comments
 (0)
0