diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c24d1004..7344b3c52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +### 9.1.6 (2024-07-21) + +#### Compatibility + +* Ensuring compatibility with future PHP versions. + +-------------------------------------------------------- + ### 9.1.5 (2023-11-24) #### Bugfixes diff --git a/src/mako/Mako.php b/src/mako/Mako.php index 5c8721205..ab2b6b416 100644 --- a/src/mako/Mako.php +++ b/src/mako/Mako.php @@ -17,7 +17,7 @@ class Mako * * @var string */ - public const VERSION = '9.1.5'; + public const VERSION = '9.1.6'; /** * Mako major version. @@ -38,5 +38,5 @@ class Mako * * @var int */ - public const VERSION_PATCH = 5; + public const VERSION_PATCH = 6; } diff --git a/src/mako/error/handlers/cli/DevelopmentHandler.php b/src/mako/error/handlers/cli/DevelopmentHandler.php index e2e8aae4c..59230ebca 100644 --- a/src/mako/error/handlers/cli/DevelopmentHandler.php +++ b/src/mako/error/handlers/cli/DevelopmentHandler.php @@ -64,7 +64,6 @@ protected function determineExceptionType(Throwable $exception): string E_PARSE => 'Parse Error', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', - E_STRICT => 'Strict Mode Error', E_NOTICE => 'Notice', E_WARNING => 'Warning', E_RECOVERABLE_ERROR => 'Recoverable Error', diff --git a/src/mako/http/Request.php b/src/mako/http/Request.php index 17f0cacff..cbdefba9f 100644 --- a/src/mako/http/Request.php +++ b/src/mako/http/Request.php @@ -38,7 +38,6 @@ use function stripos; use function strlen; use function strpos; -use function strtok; use function strtoupper; /** @@ -342,7 +341,7 @@ public function getContentType(): string { if($this->contentType === null) { - $this->contentType = rtrim(strtok((string) $this->headers->get('content-type'), ';')); + $this->contentType = rtrim(explode(';', (string) $this->headers->get('content-type'))[0]); } return $this->contentType; diff --git a/src/mako/utility/UUID.php b/src/mako/utility/UUID.php index e840a7cdd..5148992e1 100644 --- a/src/mako/utility/UUID.php +++ b/src/mako/utility/UUID.php @@ -13,14 +13,13 @@ use function chr; use function dechex; use function explode; +use function hash; use function hex2bin; use function hexdec; -use function md5; use function microtime; use function ord; use function preg_match; use function random_bytes; -use function sha1; use function sprintf; use function str_replace; use function str_split; @@ -131,7 +130,7 @@ public static function toHexadecimal(string $bytes): string */ public static function v3(string $namespace, string $name): string { - $hash = md5(static::toBinary($namespace) . $name); + $hash = hash('md5', static::toBinary($namespace) . $name); return sprintf ( @@ -169,7 +168,7 @@ public static function v4(): string */ public static function v5(string $namespace, string $name): string { - $hash = sha1(static::toBinary($namespace) . $name); + $hash = hash('sha1', static::toBinary($namespace) . $name); return sprintf ( diff --git a/src/mako/view/compilers/Template.php b/src/mako/view/compilers/Template.php index 3462cf098..7eb2b4c95 100644 --- a/src/mako/view/compilers/Template.php +++ b/src/mako/view/compilers/Template.php @@ -9,8 +9,8 @@ use mako\file\FileSystem; +use function hash; use function ltrim; -use function md5; use function preg_match; use function preg_replace; use function preg_replace_callback; @@ -302,6 +302,6 @@ public function compile(): void // Store compiled template - $this->fileSystem->put($this->cachePath . '/' . md5($this->template) . '.php', trim($contents)); + $this->fileSystem->put($this->cachePath . '/' . hash('md5', $this->template) . '.php', trim($contents)); } } diff --git a/src/mako/view/renderers/Template.php b/src/mako/view/renderers/Template.php index 33aadda32..2af91a0d8 100644 --- a/src/mako/view/renderers/Template.php +++ b/src/mako/view/renderers/Template.php @@ -13,7 +13,7 @@ use function array_merge; use function array_pop; use function current; -use function md5; +use function hash; use function ob_get_clean; use function ob_start; use function str_replace; @@ -56,7 +56,7 @@ public function __construct( */ protected function getCompiledPath(string $view): string { - return "{$this->cachePath}/" . md5($view) . '.php'; + return "{$this->cachePath}/" . hash('md5', $view) . '.php'; } /** diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 095e87510..e75e2ca63 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,6 +1,6 @@ registerSingleton([Bar::class, 'bar'], function () { - return new Bar(uniqid(), uniqid()); + return new Bar(bin2hex(random_bytes(16)), bin2hex(random_bytes(16))); }); $this->assertFalse($container->hasInstanceOf(Bar::class)); @@ -401,7 +401,7 @@ public function testRegisterSingleton(): void $container->registerSingleton([Bar::class, 'bar'], function () { - return new Bar(uniqid(), uniqid()); + return new Bar(bin2hex(random_bytes(16)), bin2hex(random_bytes(16))); }); $this->assertEquals($container->get('bar'), $container->get('bar')); diff --git a/tests/unit/view/compilers/TemplateTest.php b/tests/unit/view/compilers/TemplateTest.php index f840578fe..d855683ee 100644 --- a/tests/unit/view/compilers/TemplateTest.php +++ b/tests/unit/view/compilers/TemplateTest.php @@ -31,7 +31,7 @@ public function getFileSystem($template, $compiled) $fileSystem->shouldReceive('get')->with($this->templateName)->once()->andReturn($template); - $fileSystem->shouldReceive('put')->with($this->cachePath . '/' . md5($this->templateName) . '.php', $compiled); + $fileSystem->shouldReceive('put')->with($this->cachePath . '/' . hash('md5', $this->templateName) . '.php', $compiled); return $fileSystem; }