Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitb27c999

Browse files
bug#32981 Fix tests/code for php 7.4 (jderusse)
This PR was merged into the 3.4 branch.Discussion----------Fix tests/code for php 7.4| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#32844| License | MIT| Doc PR | NAFix remaining tests and deprecationCommits-------05ec8a0 Fix remaining tests
2 parentsc88d125 +05ec8a0 commitb27c999

File tree

23 files changed

+166
-23
lines changed

23 files changed

+166
-23
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
264264
->canBeEnabled()
265265
->beforeNormalization()
266266
->always(function ($v) {
267-
if (true ===$v['enabled']) {
267+
if (\is_array($v) &&true ===$v['enabled']) {
268268
$workflows =$v;
269269
unset($workflows['enabled']);
270270

‎src/Symfony/Component/Config/Util/XmlUtils.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public static function phpize($value)
234234
returntrue;
235235
case'false' ===$lowercaseValue:
236236
returnfalse;
237-
caseisset($value[1]) &&'0b' ==$value[0].$value[1]:
237+
caseisset($value[1]) &&'0b' ==$value[0].$value[1] &&preg_match('/^0b[01]*$/',$value):
238238
returnbindec($value);
239239
caseis_numeric($value):
240240
return'0x' ===$value[0].$value[1] ?hexdec($value) : (float)$value;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ public function handleError($type, $message, $file, $line)
470470
}
471471

472472
if ($throw) {
473-
if (E_USER_ERROR &$type) {
473+
if (\PHP_VERSION_ID <70400 &&E_USER_ERROR &$type) {
474474
for ($i =1;isset($backtrace[$i]); ++$i) {
475475
if (isset($backtrace[$i]['function'],$backtrace[$i]['type'],$backtrace[$i -1]['function'])
476476
&&'__toString' ===$backtrace[$i]['function']

‎src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ public function testHandleError()
283283

284284
publicfunctiontestHandleUserError()
285285
{
286+
if (\PHP_VERSION_ID >=70400) {
287+
$this->markTestSkipped('PHP 7.4 allows __toString to throw exceptions');
288+
}
289+
286290
try {
287291
$handler = ErrorHandler::register();
288292
$handler->throwAt(0,true);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function remove($name)
5757
$target = &$this->fields;
5858
while (\count($segments) >1) {
5959
$path =array_shift($segments);
60-
if (!\array_key_exists($path,$target)) {
60+
if (!\is_array($target) || !\array_key_exists($path,$target)) {
6161
return;
6262
}
6363
$target = &$target[$path];
@@ -80,7 +80,7 @@ public function &get($name)
8080
$target = &$this->fields;
8181
while ($segments) {
8282
$path =array_shift($segments);
83-
if (!\array_key_exists($path,$target)) {
83+
if (!\is_array($target) || !\array_key_exists($path,$target)) {
8484
thrownew \InvalidArgumentException(sprintf('Unreachable field "%s"',$path));
8585
}
8686
$target = &$target[$path];

‎src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ public function testAccept($mode, $expected)
3333
if (!\is_callable($mode)) {
3434
switch ($mode) {
3535
case SortableIterator::SORT_BY_ACCESSED_TIME:
36-
if ('\\' === \DIRECTORY_SEPARATOR) {
37-
touch(self::toAbsolute('.git'));
38-
}else {
39-
file_get_contents(self::toAbsolute('.git'));
40-
}
36+
touch(self::toAbsolute('.git'));
4137
sleep(1);
4238
file_get_contents(self::toAbsolute('.bar'));
4339
break;

‎src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ public function testYearsOption()
471471

472472
publicfunctiontestMonthsOption()
473473
{
474+
\Locale::setDefault('en');
474475
$form =$this->factory->create(static::TESTED_TYPE,null, [
475476
'months' => [6,7],
476477
'format' => \IntlDateFormatter::SHORT,
@@ -479,8 +480,8 @@ public function testMonthsOption()
479480
$view =$form->createView();
480481

481482
$this->assertEquals([
482-
newChoiceView(6,'6','06'),
483-
newChoiceView(7,'7','07'),
483+
newChoiceView(6,'6','6'),
484+
newChoiceView(7,'7','7'),
484485
],$view['month']->vars['choices']);
485486
}
486487

@@ -544,14 +545,15 @@ public function testMonthsOptionLongFormatWithDifferentTimezone()
544545

545546
publicfunctiontestIsDayWithinRangeReturnsTrueIfWithin()
546547
{
548+
\Locale::setDefault('en');
547549
$view =$this->factory->create(static::TESTED_TYPE,null, [
548550
'days' => [6,7],
549551
])
550552
->createView();
551553

552554
$this->assertEquals([
553-
newChoiceView(6,'6','06'),
554-
newChoiceView(7,'7','07'),
555+
newChoiceView(6,'6','6'),
556+
newChoiceView(7,'7','7'),
555557
],$view['day']->vars['choices']);
556558
}
557559

‎src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ abstract class AbstractCurrencyDataProviderTest extends AbstractDataProviderTest
589589
* @var CurrencyDataProvider
590590
*/
591591
protected$dataProvider;
592+
private$defaultLocale;
592593

593594
protectedfunctionsetUp()
594595
{
@@ -598,6 +599,15 @@ protected function setUp()
598599
$this->getDataDirectory().'/'.Intl::CURRENCY_DIR,
599600
$this->createEntryReader()
600601
);
602+
603+
$this->defaultLocale = \Locale::getDefault();
604+
}
605+
606+
protectedfunctiontearDown()
607+
{
608+
parent::tearDown();
609+
610+
\Locale::setDefault($this->defaultLocale);
601611
}
602612

603613
abstractprotectedfunctiongetDataDirectory();

‎src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ abstract class AbstractLanguageDataProviderTest extends AbstractDataProviderTest
831831
* @var LanguageDataProvider
832832
*/
833833
protected$dataProvider;
834+
private$defaultLocale;
834835

835836
protectedfunctionsetUp()
836837
{
@@ -840,6 +841,15 @@ protected function setUp()
840841
$this->getDataDirectory().'/'.Intl::LANGUAGE_DIR,
841842
$this->createEntryReader()
842843
);
844+
845+
$this->defaultLocale = \Locale::getDefault();
846+
}
847+
848+
protectedfunctiontearDown()
849+
{
850+
parent::tearDown();
851+
852+
\Locale::setDefault($this->defaultLocale);
843853
}
844854

845855
abstractprotectedfunctiongetDataDirectory();

‎src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLocaleDataProviderTest.php‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ abstract class AbstractLocaleDataProviderTest extends AbstractDataProviderTest
2323
* @var LocaleDataProvider
2424
*/
2525
protected$dataProvider;
26+
private$defaultLocale;
2627

2728
protectedfunctionsetUp()
2829
{
@@ -32,6 +33,13 @@ protected function setUp()
3233
$this->getDataDirectory().'/'.Intl::LOCALE_DIR,
3334
$this->createEntryReader()
3435
);
36+
37+
$this->defaultLocale = \Locale::getDefault();
38+
}
39+
40+
protectedfunctiontearDown()
41+
{
42+
\Locale::setDefault($this->defaultLocale);
3543
}
3644

3745
abstractprotectedfunctiongetDataDirectory();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp