Skip to content

Undefined constant fallback deprecated; mentioned as E_NOTICE (in language.types.string) #2779

Closed
@o0h

Description

@o0h

On types > string's page, there's a description in Complex (curly) syntax section as follows:

// This is wrong for the same reason as $foo[bar] is wrong outside a string.
// In other words, it will still work, but only because PHP first looks for a
// constant named foo; an error of level E_NOTICE (undefined constant) will be
// thrown.
echo “This is wrong: {$arr[foo][3]}“;

This code doesn't work in PHP 8.
On the Array page, it was corrected in #795.
Similarly, I believe it would be desirable to address this on the String page as well.

  • Remove the relevant description from the page entirely.
  • Just like the fix on the Array page, add an explanation stating, "As of PHP 8.0.0, it has been removed and throws an Error exception."

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions