Skip to content

Reflection(Class)Constant::__toString() should not warn on NAN conversions #22683

Closed

Description

@DanielEScherzer
<?php

echo new ReflectionConstant('NAN');

class Demo {
    public const MY_NAN = NAN;
}

echo new ReflectionClassConstant(Demo::class, 'MY_NAN');

results in:

Warning: unexpected NAN value was coerced to string in /in/868PE on line 3
Constant [ <persistent> float NAN ] { NAN }

Warning: unexpected NAN value was coerced to string in /in/868PE on line 9
Constant [ public float MY_NAN ] { NAN }

but the reflection extension shouldn't emit these warnings when the extension is responsible for the conversion - they are emitted by the __toString() call, not the echo

Activity

  1. removed their assignment
    on Jul 11, 2026
  2. added a commit that references this issue on Jul 13, 2026
    ab20db9
  3. added a commit that references this issue on Jul 13, 2026
    c559d6f
  4. added a commit that references this issue on Jul 13, 2026
    aaa141a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions