mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 04:34:31 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@45730 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -754,8 +754,8 @@ function wp_tinymce_inline_scripts() {
|
||||
$init_obj .= $key . ':' . $val . ',';
|
||||
continue;
|
||||
} elseif ( ! empty( $value ) && is_string( $value ) && (
|
||||
( '{' === $value{0} && '}' === $value{strlen( $value ) - 1} ) ||
|
||||
( '[' === $value{0} && ']' === $value{strlen( $value ) - 1} ) ||
|
||||
( '{' === $value[0] && '}' === $value[ strlen( $value ) - 1 ] ) ||
|
||||
( '[' === $value[0] && ']' === $value[ strlen( $value ) - 1 ] ) ||
|
||||
preg_match( '/^\(?function ?\(/', $value ) ) ) {
|
||||
$init_obj .= $key . ':' . $value . ',';
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user