8000 Merge branch '2.7' into 2.8 · symfony/symfony@e8b102e · GitHub
[go: up one dir, main page]

Skip to content

Commit e8b102e

Browse files
Merge branch '2.7' into 2.8
* 2.7: [ci] use hirak/prestissimo [Filesystem] Fix transient tests [HttpFoundation] Avoid warnings when checking malicious IPs [HttpFoundation] Set the Content-Range header if the requested Range is unsatisfied Conflicts: src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
2 parents ff93c1a + def0176 commit e8b102e

File tree

14 files changed

+102
-10
lines changed

14 files changed

+102
-10
lines changed
File renamed without changes.

.composer/composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"require": {
3+
"php": ">=5.3.7",
4+
"hirak/prestissimo": "^0.1.15"
5+
}
6+
}

.composer/composer.lock

Lines changed: 72 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ before_install:
4949
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0; fi;
5050
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi;
5151
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi;
52-
- if [[ $TRAVIS_REPO_SLUG = symfony/symfony ]]; then cp .composer-auth.json ~/.composer/auth.json; fi;
5352
- if [[ $deps != skip ]]; then composer self-update; fi;
53+
- if [[ $deps != skip && $TRAVIS_REPO_SLUG = symfony/symfony ]]; then cp .composer/* ~/.composer/; composer global install --prefer-dist; fi;
5454
- if [[ $deps != skip ]]; then ./phpunit install; fi;
5555
- export PHPUNIT=$(readlink -f ./phpunit)
5656

appveyor.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ init:
1818
install:
1919
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
2020
- cd c:\php
21+
- IF %PHP%==1 appveyor DownloadFile https://curl.haxx.se/ca/cacert.pem
2122
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-5.3.11-nts-Win32-VC9-x86.zip
2223
- IF %PHP%==1 7z x php-5.3.11-nts-Win32-VC9-x86.zip -y >nul
2324
- IF %PHP%==1 appveyor DownloadFile http://nebm.ist.utl.pt/~glopes/misc/intl_win/ICU-51.2-dlls.zip
@@ -38,6 +39,8 @@ install:
3839
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini-min
3940
- IF %PHP%==1 echo extension_dir=ext >> php.ini-min
4041
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini-min
42+
- IF %PHP%==1 echo extension=php_curl.dll >> php.ini-min
43+
- IF %PHP%==1 echo curl.cainfo=c:\php\cacert.pem >> php.ini-min
4144
- IF %PHP%==1 copy /Y php.ini-min php.ini-max
4245
- IF %PHP%==1 echo extension=php_apcu.dll >> php.ini-max
4346
- IF %PHP%==1 echo apc.enable_cli=1 >> php.ini-max
@@ -51,7 +54,8 @@ install:
5154
- copy /Y php.ini-max php.ini
5255
- cd c:\projects\symfony
5356
- mkdir %APPDATA%\Composer
54-
- IF %APPVEYOR_REPO_NAME%==symfony/symfony copy /Y .composer-auth.json %APPDATA%\Composer\auth.json
57+
- IF %APPVEYOR_REPO_NAME%==symfony/symfony copy /Y .composer\* %APPDATA%\Composer\
58+
- IF %APPVEYOR_REPO_NAME%==symfony/symfony composer global install --prefer-dist --no-progress --ansi || echo curl.cainfo needs PHP 5.3.7
5559
- php phpunit install
5660
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
5761
- composer update --prefer-dist --no-progress --ansi

src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
2222

2323
public function prepare_workspace()
2424
{
25-
$this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().mt_rand(0, 1000);
25+
$this->workspace = sys_get_temp_dir().'/'.microtime(true).'.'.mt_rand();
2626
mkdir($this->workspace, 0777, true);
2727
$this->workspace = realpath($this->workspace);
2828
}

src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function setUp()
4646
{
4747
$this->umask = umask(0);
4848
$this->filesystem = new Filesystem();
49-
$this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().mt_rand(0, 1000);
49+
$this->workspace = sys_get_temp_dir().'/'.microtime(true).'.'.mt_rand();
5050
mkdir($this->workspace, 0777, true);
5151
$this->workspace = realpath($this->workspace);
5252
}

src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ public function prepare(Request $request)
253253
if ($start <= $end) {
254254
if ($start < 0 || $end > $fileSize - 1) {
255255
$this->setStatusCode(416);
256+
$this->headers->set('Content-Range', sprintf('bytes */%s', $fileSize));
256257
} elseif ($start !== 0 || $end !== $fileSize - 1) {
257258
$this->maxlen = $end < $fileSize ? $end - $start + 1 : -1;
258259
$this->offset = $start;

src/Symfony/Component/HttpFoundation/IpUtils.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,12 @@ public static function checkIp6($requestIp, $ip)
112112
$netmask = 128;
113113
}
114114

115-
$bytesAddr = unpack('n*', inet_pton($address));
116-
$bytesTest = unpack('n*', inet_pton($requestIp));
115+
$bytesAddr = unpack('n*', @inet_pton($address));
116+
$bytesTest = unpack('n*', @inet_pton($requestIp));
117+
118+
if (!$bytesAddr || !$bytesTest) {
119+
return false;
120+
}
117121

118122
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; ++$i) {
119123
$left = $netmask - 16 * ($i - 1);

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,8 @@ public function getClientIps()
830830

831831
if (!filter_var($clientIp, FILTER_VALIDATE_IP)) {
832832
unset($clientIps[$key]);
833+
834+
continue;
833835
}
834836

835837
if (IpUtils::checkIp($clientIp, self::$trustedProxies)) {

src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function testInvalidRequests($requestRange)
211211
$response->sendContent();
212212

213213
$this->assertEquals(416, $response->getStatusCode());
214-
#$this->assertEquals('', $response->headers->get('Content-Range'));
214+
$this->assertEquals('bytes */35', $response->headers->get('Content-Range'));
215215
}
216216

217217
public function provideInvalidRanges()

src/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public function testIpv6Provider()
6363
array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '2a01:198:603:0::/65')),
6464
array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('2a01:198:603:0::/65', '::1')),
6565
array(false, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '1a01:198:603:0::/65')),
66+
array(false, '}__test|O:21:&quot;JDatabaseDriverMysqli&quot;:3:{s:2', '::1'),
67+
array(false, '2a01:198:603:0:396e:4789:8e99:890f', 'unknown'),
6668
);
6769
}
6870

src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,7 @@ public function testGetClientIpsProvider()
912912

913913
// invalid forwarded IP is ignored
914914
array(array('88.88.88.88'), '127.0.0.1', 'unknown,88.88.88.88', array('127.0.0.1')),
915+
array(array('88.88.88.88'), '127.0.0.1', '}__test|O:21:&quot;JDatabaseDriverMysqli&quot;:3:{s:2,88.88.88.88', array('127.0.0.1')),
915916
);
916917
}
917918

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,11 @@ public function testFormatWithDateTimeZoneGmtOffset()
405405
$this->assertEquals('GMT+03:00', $formatter->format(0));
406406
}
407407

408-
/**
409-
* @requires extension intl
410-
*/
411408
public function testFormatWithIntlTimeZone()
412409
{
410+
if (!extension_loaded('intl')) {
411+
$this->markTestSkipped('Extension intl is required.');
412+
}
413413
if (PHP_VERSION_ID < 50500 && !method_exists('IntlDateFormatter', 'setTimeZone')) {
414414
$this->markTestSkipped('Only in PHP 5.5+ IntlDateFormatter allows to use DateTimeZone objects.');
415415
}

0 commit comments

Comments
 (0)
0