8000 Merge branch '3.4' into 4.4 · symfony/symfony@c8c227f · GitHub
[go: up one dir, main page]

Skip to content

Commit c8c227f

Browse files
Merge branch '3.4' into 4.4
* 3.4: [Form] Sync translations Added dutch translations for new invalid messages Don't skip Doctrine tests on php 8. Bump APCu to 5.1.19 on Travis. [WebProfilerBundle] Hide debug toolbar in print view indexBy does not refer to attributes, but to column names Fix Reflection file name with eval()\'d code [HttpFoundation] Fix Range Requests
2 parents 65b41de + 3ed5ec0 commit c8c227f

File tree

16 files changed

+196
-91
lines changed

16 files changed

+196
-91
lines changed

.travis.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -123,23 +123,6 @@ before_install:
123123
}
124124
export -f tpecl
125125
126-
install_apcu_dev () {
127-
local ref=$1
128-
local INI=$2
129-
130-
wget https://github.com/krakjoe/apcu/archive/${ref}.zip
131-
unzip ${ref}.zip
132-
cd apcu-${ref}
133-
phpize
134-
./configure
135-
make
136-
mv modules/apcu.so $(php -r "echo ini_get('extension_dir');")
137-
echo 'extension = apcu.so' >> $INI
138-
cd ..
139-
rm -rf apcu-${ref} ${ref}.zip
140-
}
141-
export -f install_apcu_dev
142-
143126
- |
144127
# Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
145128
if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
@@ -176,7 +159,7 @@ before_install:
176159
tfold ext.memcached tpecl memcached-3.1.5 memcached.so $INI
177160
tfold ext.apcu install_apcu_dev 9c36db45100d4d27ec33072f4be90f1f5a0108b7 $INI
178161
else
179-
tfold ext.apcu tpecl apcu-5.1.18 apcu.so $INI
162+
tfold ext.apcu tpecl apcu-5.1.19 apcu.so $INI
180163
tfold ext.mongodb tpecl mongodb-1.6.16 mongodb.so $INI
181164
tfold ext.zookeeper tpecl zookeeper-0.7.2 zookeeper.so $INI
182165
tfold ext.amqp tpecl amqp-1.10.2 amqp.so $INI

src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,10 @@ public function getTypes($class, $property, array $context = [])
107107
$associationMapping = $metadata->getAssociationMapping($property);
108108

109109
if (isset($associationMapping['indexBy'])) {
110-
$indexProperty = $associationMapping['indexBy'];
110+
$indexColumn = $associationMapping['indexBy'];
111111
/** @var ClassMetadataInfo $subMetadata */
112112
$subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
113-
$typeOfField = $subMetadata->getTypeOfField($indexProperty);
114-
115-
if (null === $typeOfField) {
116-
$associationMapping = $subMetadata->getAssociationMapping($indexProperty);
117-
118-
/** @var ClassMetadataInfo $subMetadata */
119-
$indexProperty = $subMetadata->getSingleAssociationReferencedJoinColumnName($indexProperty);
120-
$subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
121-
$typeOfField = $subMetadata->getTypeOfField($indexProperty);
122-
}
113+
$typeOfField = $subMetadata->getTypeOfField($subMetadata->getFieldForColumn($indexColumn));
123114

124115
if (!$collectionKeyT 10000 ype = $this->getPhpType($typeOfField)) {
125116
return null;

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,6 @@ 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-
7063
protected function setUp(): void
7164
{
7265
$this->em = DoctrineTestHelper::createTestEntityManager();

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class DoctrineDummy
4242
public $bar;
4343

4444
/**
45-
* @ManyToMany(targetEntity="DoctrineRelation", indexBy="rguid")
45+
* @ManyToMany(targetEntity="DoctrineRelation", indexBy="rguid_column")
4646
*/
4747
protected $indexedBar;
4848

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DoctrineRelation
3030
public $id;
3131

3232
/**
33-
* @Column(type="guid")
33+
* @Column(type="guid", name="rguid_column")
3434
*/
3535
protected $rguid;
3636

src/Symfony/Bridge/Doctrine/Tests/Security/RememberMe/DoctrineTokenProviderTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
*/
1414
class DoctrineTokenProviderTest extends TestCase
1515
{
16-
public static function setUpBeforeClass(): void
17-
{
18-
if (\PHP_VERSION_ID >= 80000) {
19-
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
20-
}
21-
}
22-
2316
public function testCreateNewToken()
2417
{
2518
$provider = $this->bootstrapProvider();

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@
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-
3427
public function testRefreshUserGetsUserByPrimaryKey()
3528
{
3629
$em = DoctrineTestHelper::createTestEntityManager();

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ 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-
6962
protected function setUp(): void
7063
{
7164
$this->repositoryFactory = new TestRepositoryFactory();

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,6 @@ div.sf-toolbar .sf-toolbar-block a:hover {
541541
/***** Media query print: Do not print the Toolbar. *****/
542542
@media print {
543543
.sf-toolbar {
544-
display: none;
544+
display: none !important;
545545
}
546546
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Cache\Tests\Adapter;
1313

1414
use Doctrine\DBAL\DriverManager;
15-
use Doctrine\DBAL\Version;
1615
use Psr\Cache\CacheItemPoolInterface;
1716
use Symfony\Component\Cache\Adapter\PdoAdapter;
1817
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
@@ -32,10 +31,6 @@ public static function setUpBeforeClass(): void
3231
self::markTestSkipped('Extension pdo_sqlite required.');
3332
}
3433

35-
if (\PHP_VERSION_ID >= 80000 && class_exists(Version::class)) {
36-
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
37-
}
38-
3934
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache');
4035
}
4136

src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Cache\Tests\Simple;
1313

1414
use Doctrine\DBAL\DriverManager;
15-
use Doctrine\DBAL\Version;
1615
use Psr\SimpleCache\CacheInterface;
1716
use Symfony\Component\Cache\Simple\PdoCache;
1817
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
@@ -33,10 +32,6 @@ public static function setUpBeforeClass(): void
3332
self::markTestSkipped('Extension pdo_sqlite required.');
3433
}
3534

36-
if (\PHP_VERSION_ID >= 80000 && class_exists(Version::class)) {
37-
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
38-
}
39-
4035
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache');
4136

4237
$pool = new PdoCache(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile]));

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@ private function collectLineage(string $class, array &$lineage)
481481
return;
482482
}
483483
$file = $r->getFileName();
484+
if (') : eval()\'d code' === substr($file, -17)) {
485+
$file = substr($file, 0, strrpos($file, '(', -17));
486+
}
484487
if (!$file || $this->doExport($file) === $exportedFile = $this->export($file)) {
485488
return;
486489
}

src/Symfony/Component/Form/Resources/translations/validators.en.xlf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,26 @@
114114
<source>Please provide a valid phone number.</source>
115115
<target>Please provide a valid phone number.</target>
116116
</trans-unit>
117+
<trans-unit id="124">
118+
<source>The checkbox has an invalid value.</source>
119+
<target>The checkbox has an invalid value.</target>
120+
</trans-unit>
121+
<trans-unit id="125">
122+
<source>Please enter a valid email address.</source>
123+
<target>Please enter a valid email address.</target>
124+
</trans-unit>
125+
<trans-unit id="126">
126+
<source>Please select a valid option.</source>
127+
<target>Please select a valid option.</target>
128+
</trans-unit>
129+
<trans-unit id="127">
130+
<source>Please select a valid range.</source>
131+
<target>Please select a valid range.</target>
132+
</trans-unit>
133+
<trans-unit id="128">
134+
<source>Please enter a valid week.</source>
135+
<target>Please enter a valid week.</target>
136+
</trans-unit>
117137
</body>
118138
</file>
119139
</xliff>

src/Symfony/Component/Form/Resources/translations/validators.nl.xlf

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,126 @@
1414
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
1515
<target>De CSRF-token is ongeldig. Probeer het formulier opnieuw te versturen.</target>
1616
</trans-unit>
17+
<trans-unit id="99">
18+
<source>This value is not a valid HTML5 color.</source>
19+
<target>Dit is geen geldige HTML5 kleur.</target>
20+
</trans-unit>
21+
<trans-unit id="100">
22+
<source>Please enter a valid birthdate.</source>
23+
<target>Vul een geldige geboortedatum in.</target>
24+
</trans-unit>
25+
<trans-unit id="101">
26+
<source>The selected choice is invalid.</source>
27+
<target>Deze keuze is ongeldig.</target>
28+
</trans-unit>
29+
<trans-unit id="102">
30+
<source>The collection is invalid.</source>
31+
<target>Deze collectie is ongeldig.</target>
32+
</trans-unit>
33+
<trans-unit id="103">
34+
<source>Please select a valid color.</source>
35+
<target>Kies een geldige kleur.</target>
36+
</trans-unit>
37+
<trans-unit id="104">
38+
<source>Please select a valid country.</source>
39+
<target>Kies een geldige landnaam.</target>
40+
</trans-unit>
41+
<trans-unit id="105">
42+
<source>Please select a valid currency.</source>
43+
<target>Kies een geldige valuta.</target>
44+
</trans-unit>
45+
<trans-unit id="106">
46+
<source>Please choose a valid date interval.</source>
47+
<target>Kies een geldig tijdinterval.</target>
48+
</trans-unit>
49+
<trans-unit id="107">
50+
<source>Please enter a valid date and time.</source>
51+
<target>Vul een geldige datum en tijd in.</target>
52+
</trans-unit>
53+
<trans-unit id="108">
54+
<source>Please enter a valid date.</source>
55+
<target>Vul een geldige datum in.</target>
56+
</trans-unit>
57+
<trans-unit id="109">
58+
<source>Please select a valid file.</source>
59+
<target>Kies een geldig bestand.</target>
60+
</trans-unit>
61+
<trans-unit id="110">
62+
<source>The hidden field is invalid.</source>
63+
<target>Het verborgen veld is incorrect.</target>
64+
</trans-unit>
65+
<trans-unit id="111">
66+
<source>Please enter an integer.</source>
67+
<target>Vul een geldig getal in.</target>
68+
</trans-unit>
69+
<trans-unit id="112">
70+
<source>Please select a valid language.</source>
71+
<target>Kies een geldige taal.</target>
72+
</trans-unit>
73+
<trans-unit id="113">
74+
<source>Please select a valid locale.</source>
75+
<target>Kies een geldige locale.</target>
76+
</trans-unit>
77+
<trans-unit id="114">
78+
<source>Please enter a valid money amount.</source>
79+
<target>Vul een geldig bedrag in.</target>
80+
</trans-unit>
81+
<trans-unit id="115">
82+
<source>Please enter a number.</source>
83+
<target>Vul een geldig getal in.</target>
84+
</trans-unit>
85+
<trans-unit id="116">
86+
<source>The password is invalid.</source>
87+
<target>Het wachtwoord is incorrect.</target>
88+
</trans-unit>
89+
<trans-unit id="117">
90+
<source>Please enter a percentage value.</source>
91+
<target>Vul een geldig percentage in.</target>
92+
</trans-unit>
93+
<trans-unit id="118">
94+
<source>The values do not match.</source>
95+
<target>De waardes komen niet overeen.</target>
96+
</trans-unit>
97+
<trans-unit id="119">
98+
<source>Please enter a valid time.</source>
99+
<target>Vul een geldige tijd in.</target>
100+
</trans-unit>
101+
<trans-unit id="120">
102+
<source>Please select a valid timezone.</source>
103+
<target>Vul een geldige tijdzone in.</target>
104+
</trans-unit>
105+
<trans-unit id="121">
106+
<source>Please enter a valid URL.</source>
107+
<target>Vul een geldige URL in.</target>
108+
</trans-unit>
109+
<trans-unit id="122">
110+
<source>Please enter a valid search term.</source>
111+
<target>Vul een geldige zoekterm in.</target>
112+
</trans-unit>
113+
<trans-unit id="123">
114+
<source>Please provide a valid phone number.</source>
115+
<target>Vul een geldig telefoonnummer in.</target>
116+
</trans-unit>
117+
<trans-unit id="124">
118+
<source>The checkbox has an invalid value.</source>
119+
<target>De checkbox heeft een incorrecte waarde.</target>
120+
</trans-unit>
121+
<trans-unit id="125">
122+
<source>Please enter a valid email address.</source>
123+
<target>Vul een geldig e-mailadres in.</target>
124+
</trans-unit>
125+
<trans-unit id="126">
126+
<source>Please select a valid option.</source>
127+
<target>Kies een geldige optie.</target>
128+
</trans-unit>
129+
<trans-unit id="127">
130+
<source>Please select a valid range.</source>
131+
<target>Kies een geldig bereik.</target>
132+
</trans-unit>
133+
<trans-unit id="128">
134+
<source>Please enter a valid week.</source>
135+
<target>Vul een geldige week in.</target>
136+
</trans-unit>
17137
</body>
18138
</file>
19139
</xliff>

src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -234,33 +234,36 @@ public function prepare(Request $request)
234234
$this->headers->set($type, $path);
235235
$this->maxlen = 0;
236236
}
237-
} elseif ($request->headers->has('Range')) {
237+
} elseif ($request->headers->has('Range') && $request->isMethod('GET')) {
238238
// Process the range headers.
239239
if (!$request->headers->has('If-Range') || $this->hasValidIfRangeHeader($request->headers->get('If-Range'))) {
240240
$range = $request->headers->get('Range');
241241

242-
list($start, $end) = explode('-', substr($range, 6), 2) + [0];
242+
if (0 === strpos($range, 'bytes=')) {
243+
list($start, $end) = explode('-', substr($range, 6), 2) + [0];
243244

244-
$end = ('' === $end) ? $fileSize - 1 : (int) $end;
245+
$end = ('' === $end) ? $fileSize - 1 : (int) $end;
245246

246-
if ('' === $start) {
247-
$start = $fileSize - $end;
248-
$end = $fileSize - 1;
249-
} else {
250-
$start = (int) $start;
251-
}
247+
if ('' === $start) {
248+
$start = $fileSize - $end;
249+
$end = $fileSize - 1;
250+
} else {
251+
$start = (int) $start;
252+
}
252253

253-
if ($start <= $end) {
254-
if ($start < 0 || $end > $fileSize - 1) {
255-
$this->setStatusCode(416);
256-
$this->headers->set('Content-Range', sprintf('bytes */%s', $fileSize));
257-
} elseif (0 !== $start || $end !== $fileSize - 1) {
258-
$this->maxlen = $end < $fileSize ? $end - $start + 1 : -1;
259-
$this->offset = $start;
260-
261-
$this->setStatusCode(206);
262-
$this->headers->set('Content-Range', sprintf('bytes %s-%s/%s', $start, $end, $fileSize));
263-
$this->headers->set('Content-Length', $end - $start + 1);
254+
if ($start <= $end) {
255+
$end = min($end, $fileSize - 1);
256+
if ($start < 0 || $start > $end) {
257+
$this->setStatusCode(416);
258+
$this->headers->set('Content-Range', sprintf('bytes */%s', $fileSize));
259+
} elseif ($end - $start < $fileSize - 1) {
260+
$this->maxlen = $end < $fileSize ? $end - $start + 1 : -1;
261+
$this->offset = $start;
262+
263+
$this->setStatusCode(206);
264+
$this->headers->set('Content-Range', sprintf('bytes %s-%s/%s', $start, $end, $fileSize));
265+
$this->headers->set('Content-Length', $end - $start + 1);
266+
}
264267
}
265268
}
266269
}

0 commit comments

Comments
 (0)
0