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

Fix ctype_digit deprecation #42074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2021
Merged

Conversation

alexpott
Copy link
Contributor

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #...
License MIT
Doc PR symfony/symfony-docs#...

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

@alexpott alexpott requested a review from xabbuh as a code owner July 12, 2021 20:06
@carsonbot carsonbot added this to the 4.4 milestone Jul 12, 2021
@nicolas-grekas
Copy link
Member

Thank you @alexpott.

@nicolas-grekas nicolas-grekas merged commit 19fdcba into symfony:4.4 Jul 13, 2021
@@ -161,8 +161,8 @@ public static function dump($value, int $flags = 0): string
return 'true';
case false === $value:
return 'false';
case ctype_digit($value):
return \is_string($value) ? "'$value'" : (int) $value;
Copy link
Member

@stof stof Jul 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to handle the case of is_string($value) && ctype_digit($value), to dump the value quoted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this case is handled L180, isn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, this case should be covered by is_numeric($value).

Btw, don't we also have issues when passing floats through is_numeric($value) && false === strpos($value, "\f") && ... ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could have a case dedicated to is_float I agree

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof I'm pretty sure that the next case takes care of that already.

This was referenced Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.