Skip to content

Fatal error: Curly braces?  #38

Description

@RandomTurtle

Fatal error: Array and string offset access syntax with curly braces is no longer supported in D:\D\htdocs\index.php on line 180

what's a curly braces?

I replaced the $_iflags{$i} with $_iflags[$i] but now the page loads as a blank white page.

Activity

  1. Quix0r commented on Sep 9, 2024

    @Quix0r
    Contributor

    A curly brace {} is for function/method or whole class bodies. It also is for enclosing code in if() or else() blocks and other control/loop blocks, like while(), for(), foreach() et cetera. Replacing them with brackets ([]) will tell PHP to interpret $_iflags as an array. A white empty page indicates a fatal error which means you should reverse your changes and check log files.

  2. Quix0r commented on Sep 9, 2024

    @Quix0r
    Contributor

    $_iflags is of type string here and access on its parts also known as "sub-strings" through curly braces is no longer supported by newer PHP versions. Someone needs to rewrite this code to use substr() instead.

    Plus all these type castings (int)(bool) looks odd to me.

    Here is a wonderful article about it:
    https://stackoverflow.com/questions/59158548/array-and-string-offset-access-syntax-with-curly-braces-is-deprecated

    And yes, you can use $string[$pos] syntax instead. I get an exit code 255 here with [] instead of {}.

  3. us3r1d commented on Aug 21, 2025

    @us3r1d

    @Quix0r : the first error after swapping in [] for {} on line 180 is in the deprecated call to get_magic_quotes_gpc() on line 93, which just bails out without any output.

    StackOverflow seems to think that can just be replaced with "false".

    I'm not really a PHP expert, but I'm going to see if I can get this updated to PHP8 'cause I really want to use it and not have to put up a VM running an older PHP if I can avoid that.

  4. us3r1d commented on Aug 21, 2025

    @us3r1d

    Oh, and now I look around here someone's already done a PR that does get it running on PHP8:

    #29

  5. miglen commented on May 27, 2026

    @miglen
    Member

    Fixed by #48 — the repo now runs on PHP 8.5.6 with zero deprecations. The container-based dev setup is documented in the README. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions