Skip to content

Commit 56faca9

Browse files
Merge branch '5.0' into 5.1
* 5.0: (28 commits) [Cache] $lifetime cannot be null [Serializer] minor cleanup fix merge Run PHP 8 as 7.4.99 Remove calls to deprecated ReflectionParameter::getClass(). [VarDumper] fix PHP 8 support Add php 8 to travis. [Cache] Accessing undefined constants raises an Error in php8 [Cache] allow DBAL v3 Skip Doctrine DBAL on php 8 until we have a compatible version. [DomCrawler] Catch expected ValueError. Made method signatures compatible with their corresponding traits. [ErrorHandler] Apply php8 fixes from Debug component. [DomCrawler] Catch expected ValueError. [Validator] Catch expected ValueError. [VarDumper] ReflectionFunction::isDisabled() is deprecated. [BrowserKit] Raw body with custom Content-Type header [PropertyAccess] Parse php 8 TypeErrors correctly. [Intl] Fix call to ReflectionProperty::getValue() for static properties. [HttpKernel] Prevent calling method_exists() with non-string values. ...
2 parents c403789 + a17e72e commit 56faca9

File tree

31 files changed

+185
-76
lines changed

31 files changed

+185
-76
lines changed

.travis.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ matrix:
2828
env: deps=high
2929
- php: 7.4
3030
env: deps=low
31+
- php: nightly
32+
services: [memcached]
3133
fast_finish: true
34+
allow_failures:
35+
- php: nightly
3236

3337
cache:
3438
directories:
@@ -135,7 +139,9 @@ before_install:
135139
echo session.gc_probability = 0 >> $INI
136140
echo opcache.enable_cli = 1 >> $INI
137141
echo apc.enable_cli = 1 >> $INI
138-
echo extension = memcached.so >> $INI
142+
if [[ $PHP != nightly ]]; then
143+
echo extension = memcached.so >> $INI
144+
fi
139145
done
140146
141147
- |
@@ -147,6 +153,9 @@ before_install:
147153
if ! php --ri sodium > /dev/null; then
148154
tfold ext.libsodium tpecl libsodium sodium.so $INI
149155
fi
156+
if [[ $PHP = nightly ]]; then
157+
tfold ext.memcached tpecl memcached-3.1.5 memcached.so $INI
158+
fi
150159
151160
tfold ext.apcu tpecl apcu-5.1.17 apcu.so $INI
152161
tfold ext.mongodb tpecl mongodb-1.6.0 mongodb.so $INI
@@ -222,6 +231,12 @@ install:
222231
export COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' -printf '%h\n' | sort)
223232
fi
224233
234+
- |
235+
# Set composer's platform to php 7.4 if we're on php 8.
236+
if [[ $PHP = nightly ]]; then
237+
composer config platform.php 7.4.99
238+
fi
239+
225240
- |
226241
# Install symfony/flex
227242
if [[ $deps = low ]]; then

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ class EntityTypeTest extends BaseTypeTest
6060

6161
protected static $supportedFeatureSetVersion = 404;
6262

63+
public static function setUpBeforeClass(): void
64+
{
65+
if (\PHP_VERSION_ID >= 80000) {
66+
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
67+
}
68+
}
69+
6370
protected function setUp(): void
6471
{
6572
$this->em = DoctrineTestHelper::createTestEntityManager();

src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424

2525
class EntityUserProviderTest extends TestCase
2626
{
27+
public static function setUpBeforeClass(): void
28+
{
29+
if (\PHP_VERSION_ID >= 80000) {
30+
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
31+
}
32+
}
33+
2734
public function testRefreshUserGetsUserByPrimaryKey()
2835
{
2936
$em = DoctrineTestHelper::createTestEntityManager();

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
5959

6060
protected $repositoryFactory;
6161

62+
public static function setUpBeforeClass(): void
63+
{
64+
if (\PHP_VERSION_ID >= 80000) {
65+
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
66+
}
67+
}
68+
6269
protected function setUp(): void
6370
{
6471
$this->repositoryFactory = new TestRepositoryFactory();

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
$passthruOrFail("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
198198
}
199199

200-
if (preg_match('{\^(\d++\.\d++)[\d\.]*$}', $info['requires']['php'], $phpVersion) && version_compare($phpVersion[1], PHP_VERSION, '<')) {
200+
if (preg_match('{\^((\d++\.)\d++)[\d\.]*$}', $info['requires']['php'], $phpVersion) && version_compare($phpVersion[2].'99', PHP_VERSION, '<')) {
201201
$passthruOrFail("$COMPOSER config platform.php \"$phpVersion[1].99\"");
202202
} else {
203203
$passthruOrFail("$COMPOSER config --unset platform.php");

src/Symfony/Component/BrowserKit/HttpBrowser.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ public function __construct(HttpClientInterface $client = null, History $history
3939
parent::__construct([], $history, $cookieJar);
4040
}
4141

42-
protected function doRequest($request): Response
42+
protected function doRequest(Request $request): Response
4343
{
4444
$headers = $this->getHeaders($request);
45-
[$body, $extraHeaders] = $this->getBodyAndExtraHeaders($request);
45+
[$body, $extraHeaders] = $this->getBodyAndExtraHeaders($request, $headers);
4646

4747
$response = $this->client->request($request->getMethod(), $request->getUri(), [
4848
'headers' => array_merge($headers, $extraHeaders),
@@ -56,7 +56,7 @@ protected function doRequest($request): Response
5656
/**
5757
* @return array [$body, $headers]
5858
*/
59-
private function getBodyAndExtraHeaders(Request $request): array
59+
private function getBodyAndExtraHeaders(Request $request, array $headers): array
6060
{
6161
if (\in_array($request->getMethod(), ['GET', 'HEAD'])) {
6262
return ['', []];
@@ -67,6 +67,10 @@ private function getBodyAndExtraHeaders(Request $request): array
6767
}
6868

6969
if (null !== $content = $request->getContent()) {
70+
if (isset($headers['content-type'])) {
71+
return [$content, []];
72+
}
73+
7074
$part = new TextPart($content, 'utf-8', 'plain', '8bit');
7175

7276
return [$part->bodyToString(), $part->getPreparedHeaders()->toArray()];

src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ public function validContentTypes()
5959
['POST', 'http://example.com/', [], [], [], 'content'],
6060
['POST', 'http://example.com/', ['headers' => $defaultHeaders + ['Content-Type: text/plain; charset=utf-8', 'Content-Transfer-Encoding: 8bit'], 'body' => 'content', 'max_redirects' => 0]],
6161
];
62+
yield 'POST JSON' => [
63+
['POST', 'http://example.com/', [], [], ['CONTENT_TYPE' => 'application/json'], '["content"]'],
64+
['POST', 'http://example.com/', ['headers' => $defaultHeaders + ['content-type' => 'application/json'], 'body' => '["content"]', 'max_redirects' => 0]],
65+
];
6266
}
6367

6468
public function testMultiPartRequestWithSingleFile()

src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,14 @@ public function testOptions()
7171
*/
7272
public function testBadOptions($name, $value)
7373
{
74-
$this->expectException('ErrorException');
75-
$this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::');
74+
if (\PHP_VERSION_ID < 80000) {
75+
$this->expectException('ErrorException');
76+
$this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::');
77+
} else {
78+
$this->expectException('Error');
79+
$this->expectExceptionMessage('Undefined class constant \'Memcached::');
80+
}
81+
7682
MemcachedAdapter::createConnection([], [$name => $value]);
7783
}
7884

src/Symfony/Component/Cache/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
},
3232
"require-dev": {
3333
"cache/integration-tests": "dev-master",
34-
"doctrine/cache": "~1.6",
35-
"doctrine/dbal": "~2.5",
36-
"predis/predis": "~1.1",
34+
"doctrine/cache": "^1.6",
35+
"doctrine/dbal": "^2.5|^3.0",
36+
"predis/predis": "^1.1",
3737
"psr/simple-cache": "^1.0",
3838
"symfony/config": "^4.4|^5.0",
3939
"symfony/dependency-injection": "^4.4|^5.0",

src/Symfony/Component/Config/Resource/ReflectionClassResource.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ private function generateSignature(\ReflectionClass $class): iterable
137137
$defaults = $class->getDefaultProperties();
138138

139139
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
140-
yield $p->getDocComment().$p;
140+
yield $p->getDocComment();
141+
yield $p->isDefault() ? '<default>' : '';
142+
yield $p->isPublic() ? 'public' : 'protected';
143+
yield $p->isStatic() ? 'static' : '';
144+
yield '$'.$p->name;
141145
yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true);
142146
}
143147
}

0 commit comments

Comments
 (0)