Merge branch '2.7'
* 2.7: [Debug] track and report deprecated classes and interfaces [Form] Remove a redundant test. use value of DIRECTORY_SEPARATOR to detect Windows Conflicts: src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php src/Symfony/Component/Security/Core/Util/SecureRandom.php
This commit is contained in:
commit
303df69e34
@ -91,7 +91,7 @@ EOF
|
||||
$this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers'));
|
||||
|
||||
$filesystem->rename($realCacheDir, $oldCacheDir);
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
sleep(1); // workaround for Windows PHP rename bug
|
||||
}
|
||||
$filesystem->rename($warmupDir, $realCacheDir);
|
||||
|
@ -770,7 +770,7 @@ class Application
|
||||
return $this->terminalDimensions;
|
||||
}
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
// extract [w, H] from "wxh (WxH)"
|
||||
if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
|
||||
return array((int) $matches[1], (int) $matches[2]);
|
||||
|
@ -269,7 +269,7 @@ class DialogHelper extends InputAwareHelper
|
||||
*/
|
||||
public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
|
||||
|
||||
// handle code running from a phar
|
||||
|
@ -100,7 +100,7 @@ class DialogHelperTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testAskHiddenResponse()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is not supported on Windows');
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ class DebugClassLoader
|
||||
private $isFinder;
|
||||
private $wasFinder;
|
||||
private static $caseCheck;
|
||||
private static $deprecated = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@ -175,6 +176,22 @@ class DebugClassLoader
|
||||
if ($name !== $class && 0 === strcasecmp($name, $class)) {
|
||||
throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
|
||||
}
|
||||
|
||||
if (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
|
||||
self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
|
||||
} elseif (0 !== strpos($name, 'Symfony\\')) {
|
||||
$parent = $refl->getParentClass();
|
||||
|
||||
if ($parent && isset(self::$deprecated[$parent->name])) {
|
||||
trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent->name, self::$deprecated[$parent->name]), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
foreach ($refl->getInterfaceNames() as $interface) {
|
||||
if (isset(self::$deprecated[$interface]) && !($parent && $parent->implementsInterface($interface))) {
|
||||
trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($file) {
|
||||
|
@ -156,6 +156,39 @@ class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\ClassAlias', true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideDeprecatedSuper
|
||||
*/
|
||||
public function testDeprecatedSuper($class, $super, $type)
|
||||
{
|
||||
set_error_handler('var_dump', 0);
|
||||
$e = error_reporting(0);
|
||||
trigger_error('', E_USER_DEPRECATED);
|
||||
|
||||
class_exists('Test\\'.__NAMESPACE__.'\\'.$class, true);
|
||||
|
||||
error_reporting($e);
|
||||
restore_error_handler();
|
||||
|
||||
$lastError = error_get_last();
|
||||
unset($lastError['file'], $lastError['line']);
|
||||
|
||||
$xError = array(
|
||||
'type' => E_USER_DEPRECATED,
|
||||
'message' => 'The Test\Symfony\Component\Debug\Tests\\'.$class.' class '.$type.' Symfony\Component\Debug\Tests\Fixtures\\'.$super.' that is deprecated but this is a test deprecation notice.',
|
||||
);
|
||||
|
||||
$this->assertSame($xError, $lastError);
|
||||
}
|
||||
|
||||
public function provideDeprecatedSuper()
|
||||
{
|
||||
return array(
|
||||
array('DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'),
|
||||
array('DeprecatedParentClass', 'DeprecatedClass', 'extends'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ClassLoader
|
||||
@ -185,6 +218,12 @@ class ClassLoader
|
||||
return __DIR__.'/Fixtures/reallyNotPsr0.php';
|
||||
} elseif (__NAMESPACE__.'\Fixtures\NotPSR0bis' === $class) {
|
||||
return __DIR__.'/Fixtures/notPsr0Bis.php';
|
||||
} elseif (__NAMESPACE__.'\Fixtures\DeprecatedInterface' === $class) {
|
||||
return __DIR__.'/Fixtures/DeprecatedInterface.php';
|
||||
} elseif ('Test\\'.__NAMESPACE__.'\DeprecatedParentClass' === $class) {
|
||||
eval('namespace Test\\'.__NAMESPACE__.'; class DeprecatedParentClass extends \\'.__NAMESPACE__.'\Fixtures\DeprecatedClass {}');
|
||||
} elseif ('Test\\'.__NAMESPACE__.'\DeprecatedInterfaceClass' === $class) {
|
||||
eval('namespace Test\\'.__NAMESPACE__.'; class DeprecatedInterfaceClass implements \\'.__NAMESPACE__.'\Fixtures\DeprecatedInterface {}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Debug\Tests\Fixtures;
|
||||
|
||||
/**
|
||||
* @deprecated but this is a test
|
||||
* deprecation notice.
|
||||
* @foobar
|
||||
*/
|
||||
class DeprecatedClass
|
||||
{
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Debug\Tests\Fixtures;
|
||||
|
||||
/**
|
||||
* @deprecated but this is a test
|
||||
* deprecation notice.
|
||||
* @foobar
|
||||
*/
|
||||
interface DeprecatedInterface
|
||||
{
|
||||
}
|
@ -164,7 +164,7 @@ class Filesystem
|
||||
}
|
||||
} else {
|
||||
// https://bugs.php.net/bug.php?id=52176
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR') && is_dir($file)) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && is_dir($file)) {
|
||||
if (true !== @rmdir($file)) {
|
||||
throw new IOException(sprintf('Failed to remove file "%s".', $file), 0, null, $file);
|
||||
}
|
||||
@ -307,7 +307,7 @@ class Filesystem
|
||||
if (true !== @symlink($originDir, $targetDir)) {
|
||||
$report = error_get_last();
|
||||
if (is_array($report)) {
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR') && false !== strpos($report['message'], 'error code(1314)')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) {
|
||||
throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?');
|
||||
}
|
||||
}
|
||||
@ -327,7 +327,7 @@ class Filesystem
|
||||
public function makePathRelative($endPath, $startPath)
|
||||
{
|
||||
// Normalize separators on Windows
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$endPath = strtr($endPath, '\\', '/');
|
||||
$startPath = strtr($startPath, '\\', '/');
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ class FilesystemTest extends FilesystemTestCase
|
||||
array('/a/aab/bb/', '/a/aa/', '../aab/bb/'),
|
||||
);
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$paths[] = array('c:\var\lib/symfony/src/Symfony/', 'c:/var/lib/symfony/', 'src/Symfony/');
|
||||
}
|
||||
|
||||
@ -965,7 +965,7 @@ class FilesystemTest extends FilesystemTestCase
|
||||
$this->assertSame('bar', file_get_contents($filename));
|
||||
|
||||
// skip mode check on Windows
|
||||
if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
$this->assertFilePermissions(753, $filename);
|
||||
}
|
||||
}
|
||||
@ -980,7 +980,7 @@ class FilesystemTest extends FilesystemTestCase
|
||||
$this->assertSame('bar', file_get_contents($filename));
|
||||
|
||||
// skip mode check on Windows
|
||||
if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
$this->assertFilePermissions(600, $filename);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class PathFilterIterator extends MultiplePcreFilterIterator
|
||||
{
|
||||
$filename = $this->current()->getRelativePathname();
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$filename = strtr($filename, '\\', '/');
|
||||
}
|
||||
|
||||
|
@ -745,7 +745,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
*/
|
||||
public function testAccessDeniedException(Adapter\AdapterInterface $adapter)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('chmod is not supported on Windows');
|
||||
}
|
||||
|
||||
@ -784,7 +784,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
*/
|
||||
public function testIgnoredAccessDeniedException(Adapter\AdapterInterface $adapter)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('chmod is not supported on Windows');
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ trigger_error('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderIn
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated Deprecated since version 2.4, to be removed in Symfony 3.0. Use
|
||||
* @deprecated since version 2.4, to be removed in Symfony 3.0. Use
|
||||
* {@link \Symfony\Component\Security\Csrf\CsrfTokenManagerInterface}
|
||||
* instead.
|
||||
*/
|
||||
|
@ -279,37 +279,6 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
||||
$this->assertSame($valid, $form->isValid());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideBoolean
|
||||
*/
|
||||
public function testValidateTokenOnBindIfRootAndCompoundUsesTypeClassAsIntentionIfEmptyFormName($valid)
|
||||
{
|
||||
$this->tokenManager->expects($this->once())
|
||||
->method('isTokenValid')
|
||||
->with(new CsrfToken('Symfony\Component\Form\Extension\Core\Type\FormType', 'token'))
|
||||
->will($this->returnValue($valid));
|
||||
|
||||
$form = $this->factory
|
||||
->createNamedBuilder('', 'form', null, array(
|
||||
'csrf_field_name' => 'csrf',
|
||||
'csrf_token_manager' => $this->tokenManager,
|
||||
'compound' => true,
|
||||
))
|
||||
->add('child', 'text')
|
||||
->getForm();
|
||||
|
||||
$form->submit(array(
|
||||
'child' => 'foobar',
|
||||
'csrf' => 'token',
|
||||
));
|
||||
|
||||
// Remove token from data
|
||||
$this->assertSame(array('child' => 'foobar'), $form->getData());
|
||||
|
||||
// Validate accordingly
|
||||
$this->assertSame($valid, $form->isValid());
|
||||
}
|
||||
|
||||
public function testFailIfRootAndCompoundAndTokenMissing()
|
||||
{
|
||||
$this->tokenManager->expects($this->never())
|
||||
|
@ -45,7 +45,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
|
||||
*/
|
||||
public static function isSupported()
|
||||
{
|
||||
return !defined('PHP_WINDOWS_VERSION_BUILD') && function_exists('passthru') && function_exists('escapeshellarg');
|
||||
return '\\' !== DIRECTORY_SEPARATOR && function_exists('passthru') && function_exists('escapeshellarg');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,7 +71,7 @@ class MimeTypeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGuessWithNonReadablePath()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Can not verify chmod operations on Windows');
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace Symfony\Component\HttpKernel\HttpCache;
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @deprecated Deprecated since version 2.6, to be removed in 3.0. Use ResponseCacheStrategyInterface instead
|
||||
* @deprecated since version 2.6, to be removed in 3.0. Use ResponseCacheStrategyInterface instead.
|
||||
*/
|
||||
interface EsiResponseCacheStrategyInterface extends ResponseCacheStrategyInterface
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ use Psr\Log\LoggerInterface as PsrLogger;
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @deprecated since 2.2, to be removed in 3.0. Type-hint \Psr\Log\LoggerInterface instead.
|
||||
* @deprecated since version 2.2, to be removed in 3.0. Type-hint \Psr\Log\LoggerInterface instead.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
|
@ -270,7 +270,7 @@ EOF;
|
||||
|
||||
// Heredocs are preserved, making the output mixing Unix and Windows line
|
||||
// endings, switching to "\n" everywhere on Windows to avoid failure.
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$expected = str_replace("\r\n", "\n", $expected);
|
||||
$output = str_replace("\r\n", "\n", $output);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException;
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated Deprecated since Symfony 2.6, to be removed in Symfony 3.0.
|
||||
* @deprecated since version 2.6, to be removed in Symfony 3.0.
|
||||
* Use {@link OptionsResolver} instead.
|
||||
*/
|
||||
interface OptionsResolverInterface
|
||||
|
@ -72,13 +72,13 @@ class ExecutableFinder
|
||||
}
|
||||
|
||||
$suffixes = array('');
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$pathExt = getenv('PATHEXT');
|
||||
$suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes;
|
||||
}
|
||||
foreach ($suffixes as $suffix) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && (defined('PHP_WINDOWS_VERSION_BUILD') || is_executable($file))) {
|
||||
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class PhpExecutableFinder
|
||||
}
|
||||
|
||||
$dirs = array(PHP_BINDIR);
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$dirs[] = 'C:\xampp\php\\';
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ class Process
|
||||
// on Gnu/Linux, PHP builds with --enable-maintainer-zts are also affected
|
||||
// @see : https://bugs.php.net/bug.php?id=51800
|
||||
// @see : https://bugs.php.net/bug.php?id=50524
|
||||
if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || defined('PHP_WINDOWS_VERSION_BUILD'))) {
|
||||
if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
|
||||
$this->cwd = getcwd();
|
||||
}
|
||||
if (null !== $env) {
|
||||
@ -164,10 +164,10 @@ class Process
|
||||
|
||||
$this->input = $input;
|
||||
$this->setTimeout($timeout);
|
||||
$this->useFileHandles = defined('PHP_WINDOWS_VERSION_BUILD');
|
||||
$this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
|
||||
$this->pty = false;
|
||||
$this->enhanceWindowsCompatibility = true;
|
||||
$this->enhanceSigchildCompatibility = !defined('PHP_WINDOWS_VERSION_BUILD') && $this->isSigchildEnabled();
|
||||
$this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
|
||||
$this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ class Process
|
||||
|
||||
$commandline = $this->commandline;
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD') && $this->enhanceWindowsCompatibility) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
|
||||
$commandline = 'cmd /V:ON /E:ON /C "('.$commandline.')';
|
||||
foreach ($this->processPipes->getFiles() as $offset => $filename) {
|
||||
$commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
|
||||
@ -356,8 +356,8 @@ class Process
|
||||
|
||||
do {
|
||||
$this->checkTimeout();
|
||||
$running = defined('PHP_WINDOWS_VERSION_BUILD') ? $this->isRunning() : $this->processPipes->areOpen();
|
||||
$close = !defined('PHP_WINDOWS_VERSION_BUILD') || !$running;
|
||||
$running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
|
||||
$close = '\\' !== DIRECTORY_SEPARATOR || !$running;
|
||||
$this->readPipes(true, $close);
|
||||
} while ($running);
|
||||
|
||||
@ -476,7 +476,7 @@ class Process
|
||||
|
||||
$this->requireProcessIsStarted(__FUNCTION__);
|
||||
|
||||
$this->readPipes(false, defined('PHP_WINDOWS_VERSION_BUILD') ? !$this->processInformation['running'] : true);
|
||||
$this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
|
||||
|
||||
return $this->stdout;
|
||||
}
|
||||
@ -535,7 +535,7 @@ class Process
|
||||
|
||||
$this->requireProcessIsStarted(__FUNCTION__);
|
||||
|
||||
$this->readPipes(false, defined('PHP_WINDOWS_VERSION_BUILD') ? !$this->processInformation['running'] : true);
|
||||
$this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
|
||||
|
||||
return $this->stderr;
|
||||
}
|
||||
@ -787,7 +787,7 @@ class Process
|
||||
{
|
||||
$timeoutMicro = microtime(true) + $timeout;
|
||||
if ($this->isRunning()) {
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD') && !$this->isSigchildEnabled()) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && !$this->isSigchildEnabled()) {
|
||||
exec(sprintf("taskkill /F /T /PID %d 2>&1", $this->getPid()), $output, $exitCode);
|
||||
if ($exitCode > 0) {
|
||||
throw new RuntimeException('Unable to kill the process');
|
||||
@ -936,7 +936,7 @@ class Process
|
||||
*/
|
||||
public function setTty($tty)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD') && $tty) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && $tty) {
|
||||
throw new RuntimeException('TTY mode is not supported on Windows platform.');
|
||||
}
|
||||
|
||||
@ -1278,7 +1278,7 @@ class Process
|
||||
$this->processInformation = proc_get_status($this->process);
|
||||
$this->captureExitCode();
|
||||
|
||||
$this->readPipes($blocking, defined('PHP_WINDOWS_VERSION_BUILD') ? !$this->processInformation['running'] : true);
|
||||
$this->readPipes($blocking, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
|
||||
|
||||
if (!$this->processInformation['running']) {
|
||||
$this->close();
|
||||
|
@ -42,7 +42,7 @@ class ProcessUtils
|
||||
//Fix for PHP bug #49446 escapeshellarg doesn't work on Windows
|
||||
//@see https://bugs.php.net/bug.php?id=43784
|
||||
//@see https://bugs.php.net/bug.php?id=49446
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('' === $argument) {
|
||||
return escapeshellarg($argument);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function chainedCommandsOutputProvider()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
return array(
|
||||
array("2 \r\n2\r\n", '&&', '2'),
|
||||
);
|
||||
@ -348,7 +348,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testZeroAsOutput()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
// see http://stackoverflow.com/questions/7105433/windows-batch-echo-without-new-line
|
||||
$p = $this->getProcess('echo | set /p dummyName=0');
|
||||
} else {
|
||||
@ -361,7 +361,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testExitCodeCommandFailed()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX exit code');
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testTTYCommand()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does have /dev/tty support');
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testTTYCommandExitCode()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does have /dev/tty support');
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testTTYInWindowsEnvironment()
|
||||
{
|
||||
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is for Windows platform only');
|
||||
}
|
||||
|
||||
@ -569,7 +569,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessIsNotSignaled()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -580,7 +580,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessWithoutTermSignalIsNotSignaled()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -591,7 +591,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessWithoutTermSignal()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -602,7 +602,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessIsSignaledIfStopped()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -614,7 +614,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessWithTermSignal()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -630,7 +630,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessThrowsExceptionWhenExternallySignaled()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -691,7 +691,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
$duration = microtime(true) - $start;
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
// Windows is a bit slower as it read file handles, then allow twice the precision
|
||||
$maxDuration = $timeout + 2 * Process::TIMEOUT_PRECISION;
|
||||
} else {
|
||||
@ -908,7 +908,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function verifyPosixIsEnabled()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('POSIX signals do not work on Windows');
|
||||
}
|
||||
if (!defined('SIGUSR1')) {
|
||||
@ -921,7 +921,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSignalWithWrongIntSignal()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('POSIX signals do not work on Windows');
|
||||
}
|
||||
|
||||
@ -935,7 +935,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSignalWithWrongNonIntSignal()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('POSIX signals do not work on Windows');
|
||||
}
|
||||
|
||||
@ -1063,7 +1063,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
'include \''.__DIR__.'/PipeStdinInStdoutStdErrStreamSelect.php\';',
|
||||
);
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
// Avoid XL buffers on Windows because of https://bugs.php.net/bug.php?id=65650
|
||||
$sizes = array(1, 2, 4, 8);
|
||||
} else {
|
||||
|
@ -94,7 +94,7 @@ class ExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->markTestSkipped('Requires the PHP_BINARY constant');
|
||||
}
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Cannot run test on windows');
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ class ExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function assertSamePath($expected, $tested)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals(strtolower($expected), strtolower($tested));
|
||||
} else {
|
||||
$this->assertEquals($expected, $tested);
|
||||
@ -142,6 +142,6 @@ class ExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getPhpBinaryName()
|
||||
{
|
||||
return basename(PHP_BINARY, defined('PHP_WINDOWS_VERSION_BUILD') ? '.exe' : '');
|
||||
return basename(PHP_BINARY, '\\' === DIRECTORY_SEPARATOR ? '.exe' : '');
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class PhpExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
$current = $f->find();
|
||||
|
||||
//TODO maybe php executable is custom or even Windows
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertTrue(is_executable($current));
|
||||
$this->assertTrue((bool) preg_match('/'.addSlashes(DIRECTORY_SEPARATOR).'php\.(exe|bat|cmd|com)$/i', $current), '::find() returns the executable PHP with suffixes');
|
||||
}
|
||||
|
@ -102,14 +102,14 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$pb->setPrefix('/usr/bin/php');
|
||||
|
||||
$proc = $pb->setArguments(array('-v'))->getProcess();
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php" "-v"', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php' '-v'", $proc->getCommandLine());
|
||||
}
|
||||
|
||||
$proc = $pb->setArguments(array('-i'))->getProcess();
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php" "-i"', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php' '-i'", $proc->getCommandLine());
|
||||
@ -141,7 +141,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$pb = new ProcessBuilder(array('%path%', 'foo " bar', '%baz%baz'));
|
||||
$proc = $pb->getProcess();
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertSame('^%"path"^% "foo \\" bar" "%baz%baz"', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertSame("'%path%' 'foo \" bar' '%baz%baz'", $proc->getCommandLine());
|
||||
@ -154,7 +154,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$pb->setPrefix('%prefix%');
|
||||
$proc = $pb->getProcess();
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertSame('^%"prefix"^% "arg"', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertSame("'%prefix%' 'arg'", $proc->getCommandLine());
|
||||
@ -175,7 +175,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
->setPrefix('/usr/bin/php')
|
||||
->getProcess();
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php"', $process->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php'", $process->getCommandLine());
|
||||
@ -187,7 +187,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$process = ProcessBuilder::create(array('/usr/bin/php'))
|
||||
->getProcess();
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php"', $process->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php'", $process->getCommandLine());
|
||||
|
@ -25,7 +25,7 @@ class ProcessUtilsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function dataArguments()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
return array(
|
||||
array('"\"php\" \"-v\""', '"php" "-v"'),
|
||||
array('"foo bar"', 'foo bar'),
|
||||
|
@ -114,7 +114,7 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
|
||||
|
||||
public function testStartAfterATimeout()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Restarting a timed-out process on Windows is not supported in sigchild environment');
|
||||
}
|
||||
parent::testStartAfterATimeout();
|
||||
|
@ -18,7 +18,7 @@ use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
* The SecurityContextInterface.
|
||||
*
|
||||
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
|
||||
* @deprecated Deprecated since version 2.6, to be removed in 3.0.
|
||||
* @deprecated since version 2.6, to be removed in 3.0.
|
||||
*/
|
||||
interface SecurityContextInterface extends TokenStorageInterface, AuthorizationCheckerInterface
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ class SecurityContextInterfaceTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* Test if the BC Layer is working as intended
|
||||
*
|
||||
* @deprecated Deprecated since version 2.6, to be removed in 3.0.
|
||||
* @deprecated since version 2.6, to be removed in 3.0.
|
||||
*/
|
||||
public function testConstantSync()
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ namespace Symfony\Component\Templating;
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @deprecated Deprecated in 2.4, to be removed in 3.0. Use Psr\Log\LoggerInterface instead.
|
||||
* @deprecated since version 2.4, to be removed in 3.0. Use Psr\Log\LoggerInterface instead.
|
||||
*/
|
||||
interface DebuggerInterface
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ trigger_error('The Symfony\Component\Validator\ClassBasedInterface interface was
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* @deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* Use {@link Mapping\ClassMetadataInterface} instead.
|
||||
*/
|
||||
interface ClassBasedInterface
|
||||
|
@ -85,7 +85,7 @@ trigger_error('The "Symfony\Component\Validator\ExecutionContextInterface" inter
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* @deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* Use {@link Context\ExecutionContextInterface} instead.
|
||||
*/
|
||||
interface ExecutionContextInterface
|
||||
|
@ -29,7 +29,7 @@ trigger_error('Symfony\Component\Validator\GlobalExecutionContextInterface was d
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* @deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* Use {@link Context\ExecutionContextInterface} instead.
|
||||
*/
|
||||
interface GlobalExecutionContextInterface
|
||||
|
@ -18,7 +18,7 @@ trigger_error('The "Symfony\Component\Validator\MetadataFactoryInterface" interf
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* @deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* Use {@link Mapping\Factory\MetadataFactoryInterface} instead.
|
||||
*/
|
||||
interface MetadataFactoryInterface
|
||||
|
@ -44,7 +44,7 @@ trigger_error('Symfony\Component\Validator\MetadataInterface was deprecated in v
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* @deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* Use {@link Mapping\MetadataInterface} instead.
|
||||
*/
|
||||
interface MetadataInterface
|
||||
|
@ -18,7 +18,7 @@ trigger_error('Symfony\Component\Validator\PropertyMetadataContainerInterface is
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* @deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* Use {@link Mapping\ClassMetadataInterface} instead.
|
||||
*/
|
||||
interface PropertyMetadataContainerInterface
|
||||
|
@ -26,7 +26,7 @@ trigger_error('Symfony\Component\Validator\PropertyMetadataInterface was depreca
|
||||
*
|
||||
* @see MetadataInterface
|
||||
*
|
||||
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* @deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* Use {@link Mapping\PropertyMetadataInterface} instead.
|
||||
*/
|
||||
interface PropertyMetadataInterface extends MetadataInterface
|
||||
|
@ -36,7 +36,7 @@ trigger_error('Symfony\Component\Validator\ValidationVisitorInterface was deprec
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* @deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
*/
|
||||
interface ValidationVisitorInterface
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ trigger_error('ValidatorInterface was deprecated in version 2.5 and will be remo
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* @deprecated since version 2.5, to be removed in Symfony 3.0.
|
||||
* Use {@link Validator\ValidatorInterface} instead.
|
||||
*/
|
||||
interface ValidatorInterface
|
||||
|
Reference in New Issue
Block a user