From ec4be13babcd7e1579c08f1805412fcc9f3d65c5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 17 May 2022 14:33:09 +0200 Subject: [PATCH] Reduce the number of function calls in Tar::readHeader() --- wcfsetup/install.php | 4 ++-- wcfsetup/install/files/lib/system/io/Tar.class.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install.php b/wcfsetup/install.php index 71a746189d..558a4f1a22 100644 --- a/wcfsetup/install.php +++ b/wcfsetup/install.php @@ -1074,7 +1074,7 @@ class Tar { $checksum = 0; // First part of the header for ($i = 0; $i < 148; $i++) { - $checksum += ord(substr($binaryData, $i, 1)); + $checksum += ord($binaryData[$i]); } // Calculate the checksum // Ignore the checksum value and replace it by ' ' (space) @@ -1083,7 +1083,7 @@ class Tar { } // Last part of the header for ($i = 156; $i < 512; $i++) { - $checksum += ord(substr($binaryData, $i, 1)); + $checksum += ord($binaryData[$i]); } // extract values diff --git a/wcfsetup/install/files/lib/system/io/Tar.class.php b/wcfsetup/install/files/lib/system/io/Tar.class.php index b4bc145865..af73974d55 100644 --- a/wcfsetup/install/files/lib/system/io/Tar.class.php +++ b/wcfsetup/install/files/lib/system/io/Tar.class.php @@ -311,7 +311,7 @@ class Tar implements IArchive $checksum = 0; // First part of the header for ($i = 0; $i < 148; $i++) { - $checksum += \ord(\substr($binaryData, $i, 1)); + $checksum += \ord($binaryData[$i]); } // Calculate the checksum // Ignore the checksum value and replace it by ' ' (space) @@ -320,7 +320,7 @@ class Tar implements IArchive } // Last part of the header for ($i = 156; $i < 512; $i++) { - $checksum += \ord(\substr($binaryData, $i, 1)); + $checksum += \ord($binaryData[$i]); } // extract values -- 2.20.1