Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a4139c0

Browse filesBrowse files
committed
removed code for PHP < 5.3.9
1 parent 6dc8979 commit a4139c0
Copy full SHA for a4139c0

File tree

Expand file treeCollapse file tree

12 files changed

+24
-85
lines changed
Filter options
Expand file treeCollapse file tree

12 files changed

+24
-85
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,7 @@ public function testValidation()
294294
$this->assertSame('setMetadataCache', $calls[5][0]);
295295
$this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]);
296296
$this->assertSame('setApiVersion', $calls[6][0]);
297-
298-
if (PHP_VERSION_ID < 50309) {
299-
$this->assertEquals(array(Validation::API_VERSION_2_4), $calls[6][1]);
300-
} else {
301-
$this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]);
302-
}
297+
$this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]);
303298
}
304299

305300
public function testFullyConfiguredValidationService()

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ public function testRoutingErrorIsNotExposedForProtectedResourceWhenAnonymous($c
3030
*/
3131
public function testRoutingErrorIsExposedWhenNotProtected($config)
3232
{
33-
if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50309) {
34-
$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');
35-
}
36-
3733
$client = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config));
3834
$client->insulate();
3935
$client->request('GET', '/unprotected_resource');
@@ -46,10 +42,6 @@ public function testRoutingErrorIsExposedWhenNotProtected($config)
4642
*/
4743
public function testRoutingErrorIsNotExposedForProtectedResourceWhenLoggedInWithInsufficientRights($config)
4844
{
49-
if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50309) {
50-
$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');
51-
}
52-
5345
$client = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config));
5446
$client->insulate();
5547

‎src/Symfony/Component/Debug/ErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/ErrorHandler.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public function handleError($type, $message, $file, $line, array $context)
401401
$e['stack'] = debug_backtrace(true); // Provide object
402402
}
403403
} elseif ($trace) {
404-
$e['stack'] = debug_backtrace(PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false);
404+
$e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
405405
}
406406
}
407407

‎src/Symfony/Component/DomCrawler/Crawler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Crawler.php
+1-9Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -581,15 +581,7 @@ public function html()
581581

582582
$html = '';
583583
foreach ($this->getNode(0)->childNodes as $child) {
584-
if (PHP_VERSION_ID >= 50306) {
585-
// node parameter was added to the saveHTML() method in PHP 5.3.6
586-
// @see http://php.net/manual/en/domdocument.savehtml.php
587-
$html .= $child->ownerDocument->saveHTML($child);
588-
} else {
589-
$document = new \DOMDocument('1.0', 'UTF-8');
590-
$document->appendChild($document->importNode($child, true));
591-
$html .= rtrim($document->saveHTML());
592-
}
584+
$html .= $child->ownerDocument->saveHTML($child);
593585
}
594586

595587
return $html;

‎src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,13 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer
6161
*
6262
* @throws UnexpectedTypeException if a timezone is not a string
6363
*/
64-
public function __construct($inputTimezone = null, $outputTimezone = null, $format = 'Y-m-d H:i:s', $parseUsingPipe = null)
64+
public function __construct($inputTimezone = null, $outputTimezone = null, $format = 'Y-m-d H:i:s', $parseUsingPipe = true)
6565
{
6666
parent::__construct($inputTimezone, $outputTimezone);
6767

6868
$this->generateFormat = $this->parseFormat = $format;
6969

70-
// The pipe in the parser pattern only works as of PHP 5.3.7
71-
// See http://bugs.php.net/54316
72-
$this->parseUsingPipe = null === $parseUsingPipe
73-
? PHP_VERSION_ID >= 50307
74-
: $parseUsingPipe;
70+
$this->parseUsingPipe = $parseUsingPipe || null === $parseUsingPipe;
7571

7672
// See http://php.net/manual/en/datetime.createfromformat.php
7773
// The character "|" in the format makes sure that the parts of a date

‎src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
+2-9Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,9 @@ public function dataProvider()
5757

5858
// seconds since Unix
5959
array('U', '1265213106', '2010-02-03 16:05:06 UTC'),
60-
);
6160

62-
// This test will fail < 5.3.9 - see https://bugs.php.net/51994
63-
if (PHP_VERSION_ID >= 50309) {
64-
$data[] = array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC');
65-
}
61+
array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC'),
62+
);
6663

6764
return $data;
6865
}
@@ -111,10 +108,6 @@ public function testTransformExpectsDateTime()
111108
*/
112109
public function testReverseTransformUsingPipe($format, $input, $output)
113110
{
114-
if (PHP_VERSION_ID < 50307) {
115-
$this->markTestSkipped('Pipe usage requires PHP 5.3.7 or newer.');
116-
}
117-
118111
$reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format, true);
119112

120113
$output = new \DateTime($output);

‎src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function dump(Data $data)
6060
$this->isCollected = false;
6161
}
6262

63-
$trace = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS : true;
63+
$trace = DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS;
6464
if (PHP_VERSION_ID >= 50400) {
6565
$trace = debug_backtrace($trace, 7);
6666
} else {

‎src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
+3-8Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,14 @@ public function format($timestamp)
200200
{
201201
// intl allows timestamps to be passed as arrays - we don't
202202
if (is_array($timestamp)) {
203-
$message = PHP_VERSION_ID >= 50304 ?
204-
'Only integer Unix timestamps and DateTime objects are supported' :
205-
'Only integer Unix timestamps are supported';
203+
$message = 'Only integer Unix timestamps and DateTime objects are supported';
206204

207205
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'timestamp', $timestamp, $message);
208206
}
209207

210208
// behave like the intl extension
211209
$argumentError = null;
212-
if (PHP_VERSION_ID < 50304 && !is_int($timestamp)) {
213-
$argumentError = 'datefmt_format: takes either an array or an integer timestamp value ';
214-
} elseif (PHP_VERSION_ID >= 50304 && !is_int($timestamp) && !$timestamp instanceof \DateTime) {
210+
if (!is_int($timestamp) && !$timestamp instanceof \DateTime) {
215211
$argumentError = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object';
216212
if (PHP_VERSION_ID >= 50500 && !is_int($timestamp)) {
217213
$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 @@ public function format($timestamp)
226222
return false;
227223
}
228224

229-
// As of PHP 5.3.4, IntlDateFormatter::format() accepts DateTime instances
230-
if (PHP_VERSION_ID >= 50304 && $timestamp instanceof \DateTime) {
225+
if ($timestamp instanceof \DateTime) {
231226
$timestamp = $timestamp->getTimestamp();
232227
}
233228

‎src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
+11-18Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -238,19 +238,16 @@ public function formatProvider()
238238
array('zzzzz', 0, 'GMT'),
239239
);
240240

241-
// As of PHP 5.3.4, IntlDateFormatter::format() accepts DateTime instances
242-
if (PHP_VERSION_ID >= 50304) {
243-
$dateTime = new \DateTime('@0');
244-
245-
/* general, DateTime */
246-
$formatData[] = array('y-M-d', $dateTime, '1970-1-1');
247-
$formatData[] = array("EEE, MMM d, ''yy", $dateTime, "Thu, Jan 1, '70");
248-
$formatData[] = array('h:mm a', $dateTime, '12:00 AM');
249-
$formatData[] = array('yyyyy.MMMM.dd hh:mm aaa', $dateTime, '01970.January.01 12:00 AM');
250-
251-
$formatData[] = array("yyyy.MM.dd 'at' HH:mm:ss zzz", $dateTime, '1970.01.01 at 00:00:00 GMT');
252-
$formatData[] = array('K:mm a, z', $dateTime, '0:00 AM, GMT');
253-
}
241+
$dateTime = new \DateTime('@0');
242+
243+
/* general, DateTime */
244+
$formatData[] = array('y-M-d', $dateTime, '1970-1-1');
245+
$formatData[] = array("EEE, MMM d, ''yy", $dateTime, "Thu, Jan 1, '70");
246+
$formatData[] = array('h:mm a', $dateTime, '12:00 AM');
247+
$formatData[] = array('yyyyy.MMMM.dd hh:mm aaa', $dateTime, '01970.January.01 12:00 AM');
248+
249+
$formatData[] = array("yyyy.MM.dd 'at' HH:mm:ss zzz", $dateTime, '1970.01.01 at 00:00:00 GMT');
250+
$formatData[] = array('K:mm a, z', $dateTime, '0:00 AM, GMT');
254251

255252
return $formatData;
256253
}
@@ -276,11 +273,7 @@ public function formatErrorProvider()
276273
);
277274
}
278275

279-
$message = 'datefmt_format: takes either an array or an integer timestamp value : U_ILLEGAL_ARGUMENT_ERROR';
280-
281-
if (PHP_VERSION_ID >= 50304) {
282-
$message = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object: U_ILLEGAL_ARGUMENT_ERROR';
283-
}
276+
$message = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object: U_ILLEGAL_ARGUMENT_ERROR';
284277

285278
return array(
286279
array('y-M-d', '0', $message),

‎src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ public function testFormatWithUnsupportedTimestampArgument()
5757
} catch (\Exception $e) {
5858
$this->assertInstanceOf('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException', $e);
5959

60-
if (PHP_VERSION_ID >= 50304) {
61-
$this->assertStringEndsWith('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
62-
} else {
63-
$this->assertStringEndsWith('Only integer Unix timestamps are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
64-
}
60+
$this->assertStringEndsWith('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
6561
}
6662
}
6763

‎src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php
-11Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,19 @@ public function testCostInRange()
4747

4848
public function testResultLength()
4949
{
50-
$this->skipIfPhpVersionIsNotSupported();
51-
5250
$encoder = new BCryptPasswordEncoder(self::VALID_COST);
5351
$result = $encoder->encodePassword(self::PASSWORD, null);
5452
$this->assertEquals(60, strlen($result));
5553
}
5654

5755
public function testValidation()
5856
{
59-
$this->skipIfPhpVersionIsNotSupported();
60-
6157
$encoder = new BCryptPasswordEncoder(self::VALID_COST);
6258
$result = $encoder->encodePassword(self::PASSWORD, null);
6359
$this->assertTrue($encoder->isPasswordValid($result, self::PASSWORD, null));
6460
$this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null));
6561
}
6662

67-
private function skipIfPhpVersionIsNotSupported()
68-
{
69-
if (PHP_VERSION_ID < 50307) {
70-
$this->markTestSkipped('Requires PHP >= 5.3.7');
71-
}
72-
}
73-
7463
/**
7564
* @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
7665
*/

‎src/Symfony/Component/Security/Core/Util/SecureRandom.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Util/SecureRandom.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ public function __construct($seedFile = null, LoggerInterface $logger = null)
4343
$this->logger = $logger;
4444

4545
// determine whether to use OpenSSL
46-
if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50304) {
47-
$this->useOpenSsl = false;
48-
} elseif (!function_exists('openssl_random_pseudo_bytes')) {
46+
if (!function_exists('openssl_random_pseudo_bytes')) {
4947
if (null !== $this->logger) {
5048
$this->logger->notice('It is recommended that you enable the "openssl" extension for random number generation.');
5149
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.