Skip to content

Commit

Permalink
Fixed PHP 7.4 deprecated errors (#1234)
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich authored and mrook committed Jan 8, 2020
1 parent 957d959 commit 89e644e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions classes/phing/lib/Capsule.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ public function parse($template, $outputFile = null, $append = false)
*/
protected function resolvePath($file, $basepath)
{
if (!($file{0} == DIRECTORY_SEPARATOR || $file{0} == '/')
if (!($file[0] == DIRECTORY_SEPARATOR || $file[0] == '/')
// also account for C:\ style path
&& !($file{1} == ':' && ($file{2} == DIRECTORY_SEPARATOR || $file{2} == '/'))
&& !($file[1] == ':' && ($file[2] == DIRECTORY_SEPARATOR || $file[2] == '/'))
) {
if ($basepath != null) {
$file = $basepath . DIRECTORY_SEPARATOR . $file;
Expand Down
2 changes: 1 addition & 1 deletion classes/phing/tasks/system/Basename.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function main()
// char preceding the suffix is a '.', we assume the user
// wants to remove the '.' as well
$pos = strlen($value) - strlen($this->suffix) - 1;
if ($pos > 0 && $this->suffix{0} !== '.' && $value{$pos} === '.') {
if ($pos > 0 && $this->suffix[0] !== '.' && $value[$pos] === '.') {
$pos--;
}
$value = StringHelper::substring($value, 0, $pos);
Expand Down
2 changes: 1 addition & 1 deletion classes/phing/tasks/system/CvsPassTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ final private function mangle($password)
{
$buf = "";
for ($i = 0, $plen = strlen($password); $i < $plen; $i++) {
$buf .= chr(self::$shifts[ord($password{$i})]);
$buf .= chr(self::$shifts[ord($password[$i])]);
}

return $buf;
Expand Down
2 changes: 1 addition & 1 deletion classes/phing/tasks/system/PropertyTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ protected function parsePropertyString($value, &$fragments, &$propertyRefs)
if ($pos === (strlen($value) - 1)) {
array_push($fragments, '$');
$prev = $pos + 1;
} elseif ($value{$pos + 1} !== '{') {
} elseif ($value[$pos + 1] !== '{') {

// the string positions were changed to value-1 to correct
// a fatal error coming from function substring()
Expand Down
2 changes: 1 addition & 1 deletion classes/phing/util/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static function unqualify($qualifiedName, $separator = '.')
/**
* Converts a string to an indexed array of chars
* There's really no reason for this to be used in PHP, since strings
* are all accessible using the $string{0} notation.
* are all accessible using the $string[0] notation.
*
* @param string $str
*
Expand Down
2 changes: 1 addition & 1 deletion test/classes/phing/BuildFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private function cleanBuffer($buffer)
$cleanedBuffer = "";
$cr = false;
for ($i = 0, $bufflen = strlen($buffer); $i < $bufflen; $i++) {
$ch = $buffer{$i};
$ch = $buffer[$i];
if ($ch == "\r") {
$cr = true;
continue;
Expand Down

0 comments on commit 89e644e

Please sign in to comment.