• Fatal Error:
    Got error ‘PHP message: PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in
    /wp-content/plugins/wp-download-codes/includes/helpers/string.php on line 49

    There is a few lines referencing curly brackets

    $string = $chars{rand(0, $chars_length)};

    Just need to be updated to:

    $string = $chars[rand(0, $chars_length)];

    After addressing those the site works again, still checking for any other issues.

    Thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • Sami S

    (@sami-sanpakkila)

    Excellent! Thanks for this, will try it out!

    Sami S

    (@sami-sanpakkila)

    This worked great, much appreaciated Nate!

    Thanks! It worked for string.php!

    But now I got a new message:
    Warning: Attempt to read property “ID” on null in /home/httpd/vhosts//wp-content/plugins/wp-download-codes/includes/shortcode.php on line 50 Warning: Undefined array key “yourcode” in /home/httpd/vhosts//wp-content/plugins/wp-download-codes/includes/shortcode.php on line 109 Warning: Undefined array key “yourcode” in /home/httpd/vhosts//wp-content/plugins/wp-download-codes/includes/shortcode.php on line 109

    Similar problem here – I’m getting this message after switching the lines described in the inital post: Fatal error: Array and string offset access syntax with curly braces is no longer supported in /data/web/1/000/061/036/248617/htdocs/soulshadows/wp-content/plugins/wp-download-codes/includes/helpers/string.php on line 46

    Since curly braces are mentioned, I played around with them (manually replacing some, find and replacing all of them …), but nothing helped.

    Any advice to someone who doesn’t know php?

    Thanks,
    Benjamin

    Sami S

    (@sami-sanpakkila)

    Hi Benjamin,

    It might be that a cache is still feeding the old code. Make sure to clear all caches, in WordPress and Cloudflare if you have it.

    You should only change the code on line 49 in /wp-content/plugins/wp-download-codes/includes/helpers/string.php as instructed by Nate in the first post, nothing more.

    • This reply was modified 1 year, 10 months ago by Sami S.
    Thread Starter Nate1

    (@nate1)

    @herr-klaus it should be reasonably straight forward to do, please send through the lines of code around that location in the file (Maybe line 40-60)

    Change is like so, but needs to be applied anywhere an array $chars or like that is referenced with the curly brackets $chars{} so if there is more than one reference then that would also need to be updated. (Can’t remember if there was more than one)

    $string = $chars{rand(0, $chars_length)};

    Just need to be updated to:

    $string = $chars[rand(0, $chars_length)];


    I had to update also the db.php file, because of an PHP Error.

    changed this:
    $code_unique = ( sizeof( $code_db ) == 0);
    to this:
    $code_unique = ( is_countable( $code_db ) == 0);

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘PHP 8.1’ is closed to new replies.