From 994ca98b93742723470e14c967b6876cbc86803e Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Mon, 22 Jul 2019 05:10:36 +0200
Subject: [PATCH] [WP native files] PHP 7.4 compatibility: fix deprecated curly
brace array access
PHP 7.4 will deprecated array access using curly braces.
Ref: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
---
src/wp-admin/includes/class-wp-filesystem-ftpext.php | 4 ++--
src/wp-admin/includes/class-wp-importer.php | 2 +-
src/wp-includes/class-wp-editor.php | 4 ++--
src/wp-includes/script-loader.php | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/wp-admin/includes/class-wp-filesystem-ftpext.php b/src/wp-admin/includes/class-wp-filesystem-ftpext.php
index 1a936cfd41..53b1899666 100644
a
|
b
|
class WP_Filesystem_FTPext extends WP_Filesystem_Base { |
599 | 599 | return ''; |
600 | 600 | } |
601 | 601 | $b = array(); |
602 | | $b['isdir'] = $lucifer[0]{0} === 'd'; |
603 | | $b['islink'] = $lucifer[0]{0} === 'l'; |
| 602 | $b['isdir'] = $lucifer[0][0] === 'd'; |
| 603 | $b['islink'] = $lucifer[0][0] === 'l'; |
604 | 604 | if ( $b['isdir'] ) { |
605 | 605 | $b['type'] = 'd'; |
606 | 606 | } elseif ( $b['islink'] ) { |
diff --git a/src/wp-admin/includes/class-wp-importer.php b/src/wp-admin/includes/class-wp-importer.php
index 96db3b4458..43a2038d03 100644
a
|
b
|
function get_cli_args( $param, $required = false ) { |
307 | 307 | $last_arg = $key; |
308 | 308 | } elseif ( (bool) preg_match( '/^-([a-zA-Z0-9]+)/', $args[ $i ], $match ) ) { |
309 | 309 | for ( $j = 0, $jl = strlen( $match[1] ); $j < $jl; $j++ ) { |
310 | | $key = $match[1]{$j}; |
| 310 | $key = $match[1][ $j ]; |
311 | 311 | $out[ $key ] = true; |
312 | 312 | } |
313 | 313 | |
diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php
index fb0a8eb80d..38e1871d4b 100644
a
|
b
|
final class _WP_Editors { |
757 | 757 | $options .= $key . ':' . $val . ','; |
758 | 758 | continue; |
759 | 759 | } elseif ( ! empty( $value ) && is_string( $value ) && ( |
760 | | ( '{' == $value{0} && '}' == $value{strlen( $value ) - 1} ) || |
761 | | ( '[' == $value{0} && ']' == $value{strlen( $value ) - 1} ) || |
| 760 | ( '{' == $value[0] && '}' == $value[ strlen( $value ) - 1 ] ) || |
| 761 | ( '[' == $value[0] && ']' == $value[ strlen( $value ) - 1 ] ) || |
762 | 762 | preg_match( '/^\(?function ?\(/', $value ) ) ) { |
763 | 763 | |
764 | 764 | $options .= $key . ':' . $value . ','; |
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index 6d510192fc..470f9b9b64 100644
a
|
b
|
function wp_tinymce_inline_scripts() { |
754 | 754 | $init_obj .= $key . ':' . $val . ','; |
755 | 755 | continue; |
756 | 756 | } elseif ( ! empty( $value ) && is_string( $value ) && ( |
757 | | ( '{' === $value{0} && '}' === $value{strlen( $value ) - 1} ) || |
758 | | ( '[' === $value{0} && ']' === $value{strlen( $value ) - 1} ) || |
| 757 | ( '{' === $value[0] && '}' === $value[ strlen( $value ) - 1 ] ) || |
| 758 | ( '[' === $value[0] && ']' === $value[ strlen( $value ) - 1 ] ) || |
759 | 759 | preg_match( '/^\(?function ?\(/', $value ) ) ) { |
760 | 760 | $init_obj .= $key . ':' . $value . ','; |
761 | 761 | continue; |