1 From 354d3d4f7a0c56926bd5124d2ec5bb363a9f9bc8 Mon Sep 17 00:00:00 2001
2 From: Michael Orlitzky <michael@orlitzky.com>
3 Date: Tue, 23 Nov 2021 17:34:24 -0500
4 Subject: [PATCH 1/1] includes: don't access array elements with curly braces.
6 The array{idx} syntax was deprecated in php-7.4 and has been removed
7 in php-8.0. It's trivial to use square brackets, like array[idx],
10 includes/command.inc | 6 +++---
11 includes/sitealias.inc | 6 +++---
12 2 files changed, 6 insertions(+), 6 deletions(-)
14 diff --git a/includes/command.inc b/includes/command.inc
15 index af039ad..ed0e817 100644
16 --- a/includes/command.inc
17 +++ b/includes/command.inc
18 @@ -749,16 +749,16 @@ function drush_parse_args() {
19 $command_args[] = $opt;
21 // Is the arg an option (starting with '-')?
22 - if (!empty($opt) && $opt{0} == "-" && strlen($opt) != 1) {
23 + if (!empty($opt) && $opt[0] == "-" && strlen($opt) != 1) {
24 // Do we have multiple options behind one '-'?
25 - if (strlen($opt) > 2 && $opt{1} != "-") {
26 + if (strlen($opt) > 2 && $opt[1] != "-") {
27 // Each char becomes a key of its own.
28 for ($j = 1; $j < strlen($opt); $j++) {
29 $options[substr($opt, $j, 1)] = true;
32 // Do we have a longopt (starting with '--')?
33 - elseif ($opt{1} == "-") {
34 + elseif ($opt[1] == "-") {
35 if ($pos = strpos($opt, '=')) {
36 $options[substr($opt, 2, $pos - 2)] = substr($opt, $pos + 1);
38 diff --git a/includes/sitealias.inc b/includes/sitealias.inc
39 index b9f0bb9..13a38c1 100644
40 --- a/includes/sitealias.inc
41 +++ b/includes/sitealias.inc
42 @@ -133,10 +133,10 @@ function drush_sitealias_resolve_sitespecs($site_specifications, $alias_path_con
43 function drush_sitealias_valid_alias_format($alias) {
44 return ( (strpos($alias, ',') !== false) ||
45 ((strpos($alias, '@') === FALSE ? 0 : 1) + (strpos($alias, '/') === FALSE ? 0 : 1) + (strpos($alias, '#') === FALSE ? 0 : 1) >= 2) ||
46 - ($alias{0} == '#') ||
48 + ($alias[0] == '#') ||
51 - return $alias{0} == '@';
52 + return $alias[0] == '@';