Make WordPress Core


Ignore:
Timestamp:
08/03/2019 08:20:42 PM (5 years ago)
Author:
jorbin
Message:

PHP 7.4 compatibility fix / accessing arrays/string using curly brace syntax

PHP used to allow both square brackets and curly braces to be used interchangeably for accessing array elements and string offsets. The curly bracket syntax is only allowed in a limited set of cases and can be confusing for people not used to it.
PHP 7.4 will deprecate the curly brace syntax for accessing array elements and string offsets and it is expected that support will be completely removed in PHP 8.0.
Ref: https://wiki.php.net/rfc/deprecate_curly_braces_array_access

See #47751.
Props jrf.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-pop3.php

    r42201 r45730  
    377377        while ( !preg_match('/^\.\r\n/',$line))
    378378        {
    379             if ( $line{0} == '.' ) { $line = substr($line,1); }
     379            if ( $line[0] == '.' ) { $line = substr($line,1); }
    380380            $MsgArray[$count] = $line;
    381381            $count++;
Note: See TracChangeset for help on using the changeset viewer.