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 19fdcba

Browse filesBrowse files
bug #42074 Fix ctype_digit deprecation (alexpott)
This PR was merged into the 4.4 branch. Discussion ---------- Fix ctype_digit deprecation | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Running the Yaml unit tests on PHP 8.1 built: Jul 12 2021 00:22:13 results in the following PHP Notices: ``` Testing /Users/alex/dev/symfony/src/Symfony/Component/Yaml/Tests ............................................................... 63 / 689 ( 9%) ............................................................... 126 / 689 ( 18%) ............................................................... 189 / 689 ( 27%) ............................................................... 252 / 689 ( 36%) ............................................................... 315 / 689 ( 45%) ............................................................... 378 / 689 ( 54%) ............................................................... 441 / 689 ( 64%) ............................................................... 504 / 689 ( 73%) ............................................................... 567 / 689 ( 82%) ............................................................... 630 / 689 ( 91%) ........................................................... 689 / 689 (100%) Time: 00:00.336, Memory: 20.00 MB OK (689 tests, 984 assertions) Unsilenced deprecation notices (131) 109x: ctype_digit(): Argument of type int will be interpreted as string in the future 53x in DumperTest::testSpecifications from Symfony\Component\Yaml\Tests 21x in DumperTest::testInlineLevel from Symfony\Component\Yaml\Tests 16x in InlineTest::testDump from Symfony\Component\Yaml\Tests 7x in DumperTest::testDumpingArrayObjectInstancesWithNumericKeysInlined from Symfony\Component\Yaml\Tests 7x in DumperTest::testDumpingArrayObjectInstancesWithNumericKeysRespectsInlineLevel from Symfony\Component\Yaml\Tests 3x in DumperTest::testIndentationInConstructor from Symfony\Component\Yaml\Tests 1x in DumperTest::testObjectSupportEnabled from Symfony\Component\Yaml\Tests 1x in DumperTest::testObjectSupportDisabledButNoExceptions from Symfony\Component\Yaml\Tests 22x: ctype_digit(): Argument of type float will be interpreted as string in the future 15x in DumperTest::testSpecifications from Symfony\Component\Yaml\Tests 6x in InlineTest::testDump from Symfony\Component\Yaml\Tests 1x in InlineTest::testDumpNumericValueWithLocale from Symfony\Component\Yaml\Tests ``` Commits ------- 5c57324 Fix ctype_digit deprecation
2 parents 0a288bd + 5c57324 commit 19fdcba
Copy full SHA for 19fdcba

File tree

1 file changed

+2
-2
lines changed
Filter options

1 file changed

+2
-2
lines changed

‎src/Symfony/Component/Yaml/Inline.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Inline.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ public static function dump($value, int $flags = 0): string
161161
return 'true';
162162
case false === $value:
163163
return 'false';
164-
case ctype_digit($value):
165-
return \is_string($value) ? "'$value'" : (int) $value;
164+
case \is_int($value):
165+
return $value;
166166
case is_numeric($value) && false === strpos($value, "\f") && false === strpos($value, "\n") && false === strpos($value, "\r") && false === strpos($value, "\t") && false === strpos($value, "\v"):
167167
$locale = setlocale(\LC_NUMERIC, 0);
168168
if (false !== $locale) {

0 commit comments

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