removed code for PHP < 5.3.9
This commit is contained in:
parent
6dc897931b
commit
a4139c0be5
@ -294,12 +294,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$this->assertSame('setMetadataCache', $calls[5][0]);
|
||||
$this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]);
|
||||
$this->assertSame('setApiVersion', $calls[6][0]);
|
||||
|
||||
if (PHP_VERSION_ID < 50309) {
|
||||
$this->assertEquals(array(Validation::API_VERSION_2_4), $calls[6][1]);
|
||||
} else {
|
||||
$this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]);
|
||||
}
|
||||
$this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]);
|
||||
}
|
||||
|
||||
public function testFullyConfiguredValidationService()
|
||||
|
@ -30,10 +30,6 @@ class SecurityRoutingIntegrationTest extends WebTestCase
|
||||
*/
|
||||
public function testRoutingErrorIsExposedWhenNotProtected($config)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50309) {
|
||||
$this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
|
||||
}
|
||||
|
||||
$client = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config));
|
||||
$client->insulate();
|
||||
$client->request('GET', '/unprotected_resource');
|
||||
@ -46,10 +42,6 @@ class SecurityRoutingIntegrationTest extends WebTestCase
|
||||
*/
|
||||
public function testRoutingErrorIsNotExposedForProtectedResourceWhenLoggedInWithInsufficientRights($config)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50309) {
|
||||
$this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
|
||||
}
|
||||
|
||||
$client = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config));
|
||||
$client->insulate();
|
||||
|
||||
|
@ -401,7 +401,7 @@ class ErrorHandler
|
||||
$e['stack'] = debug_backtrace(true); // Provide object
|
||||
}
|
||||
} elseif ($trace) {
|
||||
$e['stack'] = debug_backtrace(PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false);
|
||||
$e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -581,15 +581,7 @@ class Crawler extends \SplObjectStorage
|
||||
|
||||
$html = '';
|
||||
foreach ($this->getNode(0)->childNodes as $child) {
|
||||
if (PHP_VERSION_ID >= 50306) {
|
||||
// node parameter was added to the saveHTML() method in PHP 5.3.6
|
||||
// @see http://php.net/manual/en/domdocument.savehtml.php
|
||||
$html .= $child->ownerDocument->saveHTML($child);
|
||||
} else {
|
||||
$document = new \DOMDocument('1.0', 'UTF-8');
|
||||
$document->appendChild($document->importNode($child, true));
|
||||
$html .= rtrim($document->saveHTML());
|
||||
}
|
||||
$html .= $child->ownerDocument->saveHTML($child);
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
@ -61,17 +61,13 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer
|
||||
*
|
||||
* @throws UnexpectedTypeException if a timezone is not a string
|
||||
*/
|
||||
public function __construct($inputTimezone = null, $outputTimezone = null, $format = 'Y-m-d H:i:s', $parseUsingPipe = null)
|
||||
public function __construct($inputTimezone = null, $outputTimezone = null, $format = 'Y-m-d H:i:s', $parseUsingPipe = true)
|
||||
{
|
||||
parent::__construct($inputTimezone, $outputTimezone);
|
||||
|
||||
$this->generateFormat = $this->parseFormat = $format;
|
||||
|
||||
// The pipe in the parser pattern only works as of PHP 5.3.7
|
||||
// See http://bugs.php.net/54316
|
||||
$this->parseUsingPipe = null === $parseUsingPipe
|
||||
? PHP_VERSION_ID >= 50307
|
||||
: $parseUsingPipe;
|
||||
$this->parseUsingPipe = $parseUsingPipe || null === $parseUsingPipe;
|
||||
|
||||
// See http://php.net/manual/en/datetime.createfromformat.php
|
||||
// The character "|" in the format makes sure that the parts of a date
|
||||
|
@ -57,12 +57,9 @@ class DateTimeToStringTransformerTest extends DateTimeTestCase
|
||||
|
||||
// seconds since Unix
|
||||
array('U', '1265213106', '2010-02-03 16:05:06 UTC'),
|
||||
);
|
||||
|
||||
// This test will fail < 5.3.9 - see https://bugs.php.net/51994
|
||||
if (PHP_VERSION_ID >= 50309) {
|
||||
$data[] = array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC');
|
||||
}
|
||||
array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC'),
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
@ -111,10 +108,6 @@ class DateTimeToStringTransformerTest extends DateTimeTestCase
|
||||
*/
|
||||
public function testReverseTransformUsingPipe($format, $input, $output)
|
||||
{
|
||||
if (PHP_VERSION_ID < 50307) {
|
||||
$this->markTestSkipped('Pipe usage requires PHP 5.3.7 or newer.');
|
||||
}
|
||||
|
||||
$reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format, true);
|
||||
|
||||
$output = new \DateTime($output);
|
||||
|
@ -60,7 +60,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
$this->isCollected = false;
|
||||
}
|
||||
|
||||
$trace = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS : true;
|
||||
$trace = DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS;
|
||||
if (PHP_VERSION_ID >= 50400) {
|
||||
$trace = debug_backtrace($trace, 7);
|
||||
} else {
|
||||
|
@ -200,18 +200,14 @@ class IntlDateFormatter
|
||||
{
|
||||
// intl allows timestamps to be passed as arrays - we don't
|
||||
if (is_array($timestamp)) {
|
||||
$message = PHP_VERSION_ID >= 50304 ?
|
||||
'Only integer Unix timestamps and DateTime objects are supported' :
|
||||
'Only integer Unix timestamps are supported';
|
||||
$message = 'Only integer Unix timestamps and DateTime objects are supported';
|
||||
|
||||
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'timestamp', $timestamp, $message);
|
||||
}
|
||||
|
||||
// behave like the intl extension
|
||||
$argumentError = null;
|
||||
if (PHP_VERSION_ID < 50304 && !is_int($timestamp)) {
|
||||
$argumentError = 'datefmt_format: takes either an array or an integer timestamp value ';
|
||||
} elseif (PHP_VERSION_ID >= 50304 && !is_int($timestamp) && !$timestamp instanceof \DateTime) {
|
||||
if (!is_int($timestamp) && !$timestamp instanceof \DateTime) {
|
||||
$argumentError = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object';
|
||||
if (PHP_VERSION_ID >= 50500 && !is_int($timestamp)) {
|
||||
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
|
||||
@ -226,8 +222,7 @@ class IntlDateFormatter
|
||||
return false;
|
||||
}
|
||||
|
||||
// As of PHP 5.3.4, IntlDateFormatter::format() accepts DateTime instances
|
||||
if (PHP_VERSION_ID >= 50304 && $timestamp instanceof \DateTime) {
|
||||
if ($timestamp instanceof \DateTime) {
|
||||
$timestamp = $timestamp->getTimestamp();
|
||||
}
|
||||
|
||||
|
@ -238,19 +238,16 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
array('zzzzz', 0, 'GMT'),
|
||||
);
|
||||
|
||||
// As of PHP 5.3.4, IntlDateFormatter::format() accepts DateTime instances
|
||||
if (PHP_VERSION_ID >= 50304) {
|
||||
$dateTime = new \DateTime('@0');
|
||||
$dateTime = new \DateTime('@0');
|
||||
|
||||
/* general, DateTime */
|
||||
$formatData[] = array('y-M-d', $dateTime, '1970-1-1');
|
||||
$formatData[] = array("EEE, MMM d, ''yy", $dateTime, "Thu, Jan 1, '70");
|
||||
$formatData[] = array('h:mm a', $dateTime, '12:00 AM');
|
||||
$formatData[] = array('yyyyy.MMMM.dd hh:mm aaa', $dateTime, '01970.January.01 12:00 AM');
|
||||
/* general, DateTime */
|
||||
$formatData[] = array('y-M-d', $dateTime, '1970-1-1');
|
||||
$formatData[] = array("EEE, MMM d, ''yy", $dateTime, "Thu, Jan 1, '70");
|
||||
$formatData[] = array('h:mm a', $dateTime, '12:00 AM');
|
||||
$formatData[] = array('yyyyy.MMMM.dd hh:mm aaa', $dateTime, '01970.January.01 12:00 AM');
|
||||
|
||||
$formatData[] = array("yyyy.MM.dd 'at' HH:mm:ss zzz", $dateTime, '1970.01.01 at 00:00:00 GMT');
|
||||
$formatData[] = array('K:mm a, z', $dateTime, '0:00 AM, GMT');
|
||||
}
|
||||
$formatData[] = array("yyyy.MM.dd 'at' HH:mm:ss zzz", $dateTime, '1970.01.01 at 00:00:00 GMT');
|
||||
$formatData[] = array('K:mm a, z', $dateTime, '0:00 AM, GMT');
|
||||
|
||||
return $formatData;
|
||||
}
|
||||
@ -276,11 +273,7 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
$message = 'datefmt_format: takes either an array or an integer timestamp value : U_ILLEGAL_ARGUMENT_ERROR';
|
||||
|
||||
if (PHP_VERSION_ID >= 50304) {
|
||||
$message = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object: U_ILLEGAL_ARGUMENT_ERROR';
|
||||
}
|
||||
$message = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object: U_ILLEGAL_ARGUMENT_ERROR';
|
||||
|
||||
return array(
|
||||
array('y-M-d', '0', $message),
|
||||
|
@ -57,11 +57,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
|
||||
} catch (\Exception $e) {
|
||||
$this->assertInstanceOf('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException', $e);
|
||||
|
||||
if (PHP_VERSION_ID >= 50304) {
|
||||
$this->assertStringEndsWith('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
|
||||
} else {
|
||||
$this->assertStringEndsWith('Only integer Unix timestamps are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
|
||||
}
|
||||
$this->assertStringEndsWith('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,6 @@ class BCryptPasswordEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testResultLength()
|
||||
{
|
||||
$this->skipIfPhpVersionIsNotSupported();
|
||||
|
||||
$encoder = new BCryptPasswordEncoder(self::VALID_COST);
|
||||
$result = $encoder->encodePassword(self::PASSWORD, null);
|
||||
$this->assertEquals(60, strlen($result));
|
||||
@ -56,21 +54,12 @@ class BCryptPasswordEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testValidation()
|
||||
{
|
||||
$this->skipIfPhpVersionIsNotSupported();
|
||||
|
||||
$encoder = new BCryptPasswordEncoder(self::VALID_COST);
|
||||
$result = $encoder->encodePassword(self::PASSWORD, null);
|
||||
$this->assertTrue($encoder->isPasswordValid($result, self::PASSWORD, null));
|
||||
$this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null));
|
||||
}
|
||||
|
||||
private function skipIfPhpVersionIsNotSupported()
|
||||
{
|
||||
if (PHP_VERSION_ID < 50307) {
|
||||
$this->markTestSkipped('Requires PHP >= 5.3.7');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
|
||||
*/
|
||||
|
@ -43,9 +43,7 @@ final class SecureRandom implements SecureRandomInterface
|
||||
$this->logger = $logger;
|
||||
|
||||
// determine whether to use OpenSSL
|
||||
if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50304) {
|
||||
$this->useOpenSsl = false;
|
||||
} elseif (!function_exists('openssl_random_pseudo_bytes')) {
|
||||
if (!function_exists('openssl_random_pseudo_bytes')) {
|
||||
if (null !== $this->logger) {
|
||||
$this->logger->notice('It is recommended that you enable the "openssl" extension for random number generation.');
|
||||
}
|
||||
|
Reference in New Issue
Block a user