Skip to content

Commit 49af2f4

Browse files
committed
Fix PHP 7.4 deprecation: array/string curly braces access
Signed-off-by: Jack Cherng <[email protected]>
1 parent d87bedb commit 49af2f4

12 files changed

+18
-18
lines changed

PEAR/Command/Channels.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ function doAlias($command, $options, $params)
673673
return $this->raiseError('No channel alias specified');
674674
}
675675

676-
if (count($params) !== 2 || (!empty($params[1]) && $params[1]{0} == '-')) {
676+
if (count($params) !== 2 || (!empty($params[1]) && $params[1][0] == '-')) {
677677
return $this->raiseError(
678678
'Invalid format, correct is: channel-alias channel alias');
679679
}

PEAR/Command/Common.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function getGetoptArgs($command, &$short_args, &$long_args)
146146
foreach ($this->commands[$command]['options'] as $option => $info) {
147147
$larg = $sarg = '';
148148
if (isset($info['arg'])) {
149-
if ($info['arg']{0} == '(') {
149+
if ($info['arg'][0] == '(') {
150150
$larg = '==';
151151
$sarg = '::';
152152
$arg = substr($info['arg'], 1, -1);

PEAR/DependencyDB.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function assertDepsDB()
174174
$this->rebuildDB();
175175
}
176176

177-
if ($depdb['_version']{0} > $this->_version[0]) {
177+
if ($depdb['_version'][0] > $this->_version[0]) {
178178
return PEAR::raiseError('Dependency database is version ' .
179179
$depdb['_version'] . ', and we are version ' .
180180
$this->_version . ', cannot continue');

PEAR/Installer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ function _installFile($file, $atts, $tmp_path, $options)
225225
$os = new OS_Guess();
226226
}
227227

228-
if (strlen($atts['platform']) && $atts['platform']{0} == '!') {
228+
if (strlen($atts['platform']) && $atts['platform'][0] == '!') {
229229
$negate = true;
230230
$platform = substr($atts['platform'], 1);
231231
} else {

PEAR/PackageFile/Generator/v1.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -889,13 +889,13 @@ function _convertRelease2_0(&$release, $package)
889889
}
890890
//o <install as=..> tags for <file name=... platform=!... install-as=..>
891891
if (isset($package['platform'][$file]) &&
892-
$package['platform'][$file]{0} == '!') {
892+
$package['platform'][$file][0] == '!') {
893893
$generic[] = $file;
894894
continue;
895895
}
896896
//o <ignore> tags for <file name=... platform=... install-as=..>
897897
if (isset($package['platform'][$file]) &&
898-
$package['platform'][$file]{0} != '!') {
898+
$package['platform'][$file][0] != '!') {
899899
$genericIgnore[] = $file;
900900
continue;
901901
}
@@ -959,7 +959,7 @@ function _convertRelease2_0(&$release, $package)
959959
// <file name=... platform=!other platform install-as=..>
960960
if (isset($package['platform'][$file]) &&
961961
$package['platform'][$file] != "!$os" &&
962-
$package['platform'][$file]{0} == '!') {
962+
$package['platform'][$file][0] == '!') {
963963
$release[$releaseNum]['filelist']['install'][] =
964964
array(
965965
'attribs' => array(
@@ -984,7 +984,7 @@ function _convertRelease2_0(&$release, $package)
984984
//o <ignore> tags for
985985
// <file name=... platform=other platform install-as=..>
986986
if (isset($package['platform'][$file]) &&
987-
$package['platform'][$file]{0} != '!' &&
987+
$package['platform'][$file][0] != '!' &&
988988
$package['platform'][$file] != $os) {
989989
$release[$releaseNum]['filelist']['ignore'][] =
990990
array(

PEAR/PackageFile/v2/Validator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1080,8 +1080,8 @@ function _validateFilelist($list = false, $allowignore = false, $dirs = '')
10801080
foreach ($list['file'] as $i => $file)
10811081
{
10821082
if (isset($file['attribs']) && isset($file['attribs']['name'])) {
1083-
if ($file['attribs']['name']{0} == '.' &&
1084-
$file['attribs']['name']{1} == '/') {
1083+
if ($file['attribs']['name'][0] == '.' &&
1084+
$file['attribs']['name'][1] == '/') {
10851085
// name is something like "./doc/whatever.txt"
10861086
$this->_invalidFileName($file['attribs']['name'], $dirname);
10871087
}

PEAR/Registry.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2204,7 +2204,7 @@ function parsePackageName($param, $defaultchannel = 'pear.php.net')
22042204
}
22052205
if (!isset($components['scheme'])) {
22062206
if (strpos($components['path'], '/') !== false) {
2207-
if ($components['path']{0} == '/') {
2207+
if ($components['path'][0] == '/') {
22082208
return PEAR::raiseError('parsePackageName(): this is not ' .
22092209
'a package name, it begins with "/" in "' . $param . '"',
22102210
'invalid', null, null, $param);

PEAR/Validate.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ function validateVersion()
287287
}
288288
if (!$this->_packagexml->getExtends()) {
289289
if ($versioncomponents[0] == '1') {
290-
if ($versioncomponents[2]{0} == '0') {
290+
if ($versioncomponents[2][0] == '0') {
291291
if ($versioncomponents[2] == '0') {
292292
// version 1.*.0000
293293
$this->_addWarning('version',
@@ -339,7 +339,7 @@ function validateVersion()
339339
return true;
340340
}
341341
if ($versioncomponents[0] == $majver) {
342-
if ($versioncomponents[2]{0} == '0') {
342+
if ($versioncomponents[2][0] == '0') {
343343
if ($versioncomponents[2] == '0') {
344344
// version 2.*.0000
345345
$this->_addWarning('version',

System.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public static function mkDir($args)
265265
} elseif ($opt[0] == 'm') {
266266
// if the mode is clearly an octal number (starts with 0)
267267
// convert it to decimal
268-
if (strlen($opt[1]) && $opt[1]{0} == '0') {
268+
if (strlen($opt[1]) && $opt[1][0] == '0') {
269269
$opt[1] = octdec($opt[1]);
270270
} else {
271271
// convert to int

make-gopear-phar.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function replaceVersion($contents, $path)
4040

4141
$packages = array();
4242
foreach ($dp as $entry) {
43-
if ($entry{0} == '.' || !in_array(substr($entry, -4), array('.tar'))) {
43+
if ($entry[0] == '.' || !in_array(substr($entry, -4), array('.tar'))) {
4444
continue;
4545
}
4646

make-installpear-nozlib-phar.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function replaceVersion($contents, $path)
4040

4141
$packages = array();
4242
foreach ($dp as $entry) {
43-
if ($entry{0} == '.' || !in_array(substr($entry, -4), array('.tar'))) {
43+
if ($entry[0] == '.' || !in_array(substr($entry, -4), array('.tar'))) {
4444
continue;
4545
}
4646

make-pear-bundle.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ function extract_file_from_tarball($pkg, $filename, $dest_dir) /* {{{ */
3131
break;
3232
$checksum = 0;
3333
for ($i = 0; $i < 148; $i++)
34-
$checksum += ord($hdr_data{$i});
34+
$checksum += ord($hdr_data[$i]);
3535
for ($i = 148; $i < 156; $i++)
3636
$checksum += 32;
3737
for ($i = 156; $i < 512; $i++)
38-
$checksum += ord($hdr_data{$i});
38+
$checksum += ord($hdr_data[$i]);
3939

4040
$hdr = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor", $hdr_data);
4141

0 commit comments

Comments
 (0)