From 0975ed78705fc48116fd3d8d61e20ba5503ce4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Mom=C4=8Dilovi=C4=87?= Date: Fri, 26 Jul 2019 03:04:51 +0200 Subject: [PATCH] String offset access syntax with curly braces (PHP 7.4 compat) --- src/main/php/org/bovigo/vfs/content/LargeFileContent.php | 2 +- src/main/php/org/bovigo/vfs/vfsStream.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/php/org/bovigo/vfs/content/LargeFileContent.php b/src/main/php/org/bovigo/vfs/content/LargeFileContent.php index e6d6be78..bfc4b250 100644 --- a/src/main/php/org/bovigo/vfs/content/LargeFileContent.php +++ b/src/main/php/org/bovigo/vfs/content/LargeFileContent.php @@ -132,7 +132,7 @@ protected function doRead(int $offset, int $count): string protected function doWrite(string $data, int $offset, int $length) { for ($i = 0; $i < $length; $i++) { - $this->content[$i + $offset] = $data{$i}; + $this->content[$i + $offset] = substr($data, $i, 1); } if ($offset >= $this->size) { diff --git a/src/main/php/org/bovigo/vfs/vfsStream.php b/src/main/php/org/bovigo/vfs/vfsStream.php index 08374c39..6954a7d0 100644 --- a/src/main/php/org/bovigo/vfs/vfsStream.php +++ b/src/main/php/org/bovigo/vfs/vfsStream.php @@ -353,7 +353,7 @@ public static function newFile(string $name, int $permissions = null): vfsStream */ public static function newDirectory(string $name, int $permissions = null): vfsStreamDirectory { - if ('/' === $name{0}) { + if ('/' === substr($name, 0, 1)) { $name = substr($name, 1); }