[web-downloads] main: Use time() instead of strtotime('now')

From: Date: Fri, 26 Sep 2025 08:46:25 +0000
Subject: [web-downloads] main: Use time() instead of strtotime('now')
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-33233@lists.php.net to get a copy of this message
Author: Shivam Mathur (shivammathur) Date: 2025-09-26T14:13:52+05:30 Commit: https://github.com/php/web-downloads/commit/126adb9cddb59177e7c4e89c1848017edc00794b Raw diff: https://github.com/php/web-downloads/commit/126adb9cddb59177e7c4e89c1848017edc00794b.diff Use time() instead of strtotime('now') Changed paths: M src/Console/Command/PhpCommand.php M src/Http/Controllers/PeclController.php M src/Http/Controllers/PhpController.php M src/Http/Controllers/SeriesDeleteController.php M src/Http/Controllers/SeriesInitController.php M src/Http/Controllers/SeriesStabilityController.php Diff: diff --git a/src/Console/Command/PhpCommand.php b/src/Console/Command/PhpCommand.php index 86f8044..2860e3b 100644 --- a/src/Console/Command/PhpCommand.php +++ b/src/Console/Command/PhpCommand.php @@ -55,7 +55,7 @@ public function handle(): int } foreach ($filteredFiles as $filepath) { - $hash = hash('sha256', $filepath) . strtotime('now'); + $hash = hash('sha256', $filepath) . time(); $tempDirectory = "/tmp/php-" . $hash; if (is_dir($tempDirectory)) { diff --git a/src/Http/Controllers/PeclController.php b/src/Http/Controllers/PeclController.php index 4390373..0ea0d2f 100644 --- a/src/Http/Controllers/PeclController.php +++ b/src/Http/Controllers/PeclController.php @@ -46,7 +46,7 @@ public function execute(array $data): void protected function fetchExtension(string $extension, string $ref, string $url, string $token): void { $directory = getenv('BUILDS_DIRECTORY') . "/pecl"; - $filepath = $directory . "/$extension-$ref-" . hash('sha256', $url) . strtotime('now') . ".zip"; + $filepath = $directory . "/$extension-$ref-" . hash('sha256', $url) . time() . ".zip"; if(!is_dir($directory)) { umask(0); diff --git a/src/Http/Controllers/PhpController.php b/src/Http/Controllers/PhpController.php index 8911ec2..41373a9 100644 --- a/src/Http/Controllers/PhpController.php +++ b/src/Http/Controllers/PhpController.php @@ -44,7 +44,7 @@ protected function execute(array $data): void */ private function fetchPhpBuild(string $url, string $token): void { - $hash = hash('sha256', $url) . strtotime('now'); + $hash = hash('sha256', $url) . time(); $directory = getenv('BUILDS_DIRECTORY') . "/php"; diff --git a/src/Http/Controllers/SeriesDeleteController.php b/src/Http/Controllers/SeriesDeleteController.php index c0bbd53..4c66d32 100644 --- a/src/Http/Controllers/SeriesDeleteController.php +++ b/src/Http/Controllers/SeriesDeleteController.php @@ -30,7 +30,7 @@ protected function execute(array $data): void { extract($data); $directory = getenv('BUILDS_DIRECTORY') . '/series'; - $hash = hash('sha256', $php_version) . strtotime('now'); + $hash = hash('sha256', $php_version) . time(); $file = $directory . '/series-delete-' . $hash . '.json'; file_put_contents($file, json_encode($data)); } diff --git a/src/Http/Controllers/SeriesInitController.php b/src/Http/Controllers/SeriesInitController.php index bf829ee..269e828 100644 --- a/src/Http/Controllers/SeriesInitController.php +++ b/src/Http/Controllers/SeriesInitController.php @@ -31,7 +31,7 @@ protected function execute(array $data): void { extract($data); $directory = getenv('BUILDS_DIRECTORY') . '/series'; - $hash = hash('sha256', $php_version) . strtotime('now'); + $hash = hash('sha256', $php_version) . time(); $file = $directory . '/series-init-' . $hash . '.json'; file_put_contents($file, json_encode($data)); } diff --git a/src/Http/Controllers/SeriesStabilityController.php b/src/Http/Controllers/SeriesStabilityController.php index ffe12a4..c28f328 100644 --- a/src/Http/Controllers/SeriesStabilityController.php +++ b/src/Http/Controllers/SeriesStabilityController.php @@ -30,7 +30,7 @@ protected function execute(array $data): void { extract($data); $directory = getenv('BUILDS_DIRECTORY') . '/series'; - $hash = hash('sha256', $php_version) . strtotime('now'); + $hash = hash('sha256', $php_version) . time(); $file = $directory . '/series-stability-' . $hash . '.json'; file_put_contents($file, json_encode($data)); }

« previous php.webmaster (#33233) next »