Merge branch '2.8' into 3.0

* 2.8:
  [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
This commit is contained in:
Fabien Potencier 2016-03-30 12:41:14 +02:00
commit 4e17cb2ecb
11 changed files with 44 additions and 43 deletions

View File

@ -51,6 +51,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
$zip->extractTo(getcwd());
$zip->close();
chdir("phpunit-$PHPUNIT_VERSION");
passthru("$COMPOSER remove --no-update phpspec/prophecy");
passthru("$COMPOSER remove --no-update symfony/yaml");
passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=3.1@dev\"");
passthru("$COMPOSER install --prefer-dist --no-progress --ansi", $exit);

View File

@ -11,6 +11,7 @@
namespace Symfony\Bundle\WebProfilerBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;

View File

@ -122,8 +122,10 @@ class ApcClassLoader
*/
public function findFile($class)
{
if (false === $file = apcu_fetch($this->prefix.$class)) {
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class));
$file = apcu_fetch($this->prefix.$class, $success);
if (!$success) {
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null);
}
return $file;

View File

@ -121,8 +121,10 @@ class WinCacheClassLoader
*/
public function findFile($class)
{
if (false === $file = wincache_ucache_get($this->prefix.$class)) {
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class), 0);
$file = wincache_ucache_get($this->prefix.$class, $success);
if (!$success) {
wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null, 0);
}
return $file;

View File

@ -124,7 +124,7 @@ class XcacheClassLoader
if (xcache_isset($this->prefix.$class)) {
$file = xcache_get($this->prefix.$class);
} else {
$file = $this->decorated->findFile($class);
$file = $this->decorated->findFile($class) ?: null;
xcache_set($this->prefix.$class, $file);
}

View File

@ -42,15 +42,25 @@ class DebugClassLoader
$this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
if (!isset(self::$caseCheck)) {
if(!file_exists(strtolower(__FILE__))) {
$file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
$i = strrpos($file, DIRECTORY_SEPARATOR);
$dir = substr($file, 0, 1 + $i);
$file = substr($file, 1 + $i);
$test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
$test = realpath($dir.$test);
if (false === $test || false === $i) {
// filesystem is case sensitive
self::$caseCheck = 0;
} elseif(realpath(strtolower(__FILE__)) === __FILE__) {
// filesystem is not case sensitive
} elseif (substr($test, -strlen($file)) === $file) {
// filesystem is case insensitive and realpath() normalizes the case of characters
self::$caseCheck = 1;
} else {
// filesystem is not case sensitive AND realpath() fails to normalize case
} elseif (false !== stripos(PHP_OS, 'darwin')) {
// on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters
self::$caseCheck = 2;
} else {
// filesystem case checks failed, fallback to disabling them
self::$caseCheck = 0;
}
}
}

View File

@ -60,25 +60,28 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
public function testCreateDeprecatedService()
{
$deprecations = array();
set_error_handler(function ($type, $msg) use (&$deprecations) {
if (E_USER_DEPRECATED !== $type) {
restore_error_handler();
return call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', func_get_args());
}
$deprecations[] = $msg;
});
$definition = new Definition('stdClass');
$definition->setDeprecated(true);
$that = $this;
$wasTriggered = false;
set_error_handler(function ($errno, $errstr) use ($that, &$wasTriggered) {
$that->assertSame(E_USER_DEPRECATED, $errno);
$that->assertSame('The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.', $errstr);
$wasTriggered = true;
});
$builder = new ContainerBuilder();
$builder->setDefinition('deprecated_foo', $definition);
$builder->get('deprecated_foo');
restore_error_handler();
$this->assertTrue($wasTriggered);
$this->assertCount(1, $deprecations);
$this->assertContains('The "deprecated_foo" service is deprecated. You should stop using it, as it will soon be removed.', $deprecations[0]);
}
public function testRegister()

View File

@ -203,7 +203,7 @@ class DateTimeType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$compound = function (Options $options) {
return $options['widget'] !== 'single_text';
return 'single_text' !== $options['widget'];
};
// Defaults to the value of "widget"

View File

@ -83,7 +83,7 @@ class DateType extends AbstractType
$pattern
);
// new \intlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/bug.php?id=66323
// new \IntlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/bug.php?id=66323
if (!$formatter) {
throw new InvalidOptionsException(intl_get_error_message(), intl_get_error_code());
}
@ -180,7 +180,7 @@ class DateType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$compound = function (Options $options) {
return $options['widget'] !== 'single_text';
return 'single_text' !== $options['widget'];
};
$placeholderDefault = function (Options $options) {
@ -222,7 +222,7 @@ class DateType extends AbstractType
};
$format = function (Options $options) {
return $options['widget'] === 'single_text' ? DateType::HTML5_FORMAT : DateType::DEFAULT_FORMAT;
return 'single_text' === $options['widget'] ? DateType::HTML5_FORMAT : DateType::DEFAULT_FORMAT;
};
$resolver->setDefaults(array(

View File

@ -168,7 +168,7 @@ class TimeType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$compound = function (Options $options) {
return $options['widget'] !== 'single_text';
return 'single_text' !== $options['widget'];
};
$placeholderDefault = function (Options $options) {

View File

@ -1166,24 +1166,6 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
);
}
/**
* provides default method names for simple getter/setter.
*/
public function methodProvider()
{
$defaults = array(
array('CommandLine'),
array('Timeout'),
array('WorkingDirectory'),
array('Env'),
array('Stdin'),
array('Input'),
array('Options'),
);
return $defaults;
}
/**
* @param string $commandline
* @param null|string $cwd