Skip to content

Commit

Permalink
Merge branch '9.1' into 10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
freost committed Jul 21, 2024
2 parents 775b67c + bbef96d commit 317fe23
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 18 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### 9.1.6, 10.0.9 <small>(2024-07-21)</small>

#### Compatibility

* Ensuring compatibility with future PHP versions.

--------------------------------------------------------

### 10.0.8 <small>(2024-01-25)</small>

#### Bugfixes
Expand Down Expand Up @@ -61,7 +69,7 @@

--------------------------------------------------------

### 9.1.5, 10.0.1 <small>(2023-11-24)</small>
### 9.1.5 <small>(2023-11-24)</small>

#### Bugfixes

Expand Down
4 changes: 2 additions & 2 deletions src/mako/Mako.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Mako
*
* @var string
*/
public const VERSION = '10.0.8';
public const VERSION = '10.0.9';

/**
* Mako major version.
Expand All @@ -38,5 +38,5 @@ class Mako
*
* @var int
*/
public const VERSION_PATCH = 8;
public const VERSION_PATCH = 9;
}
1 change: 0 additions & 1 deletion src/mako/error/handlers/cli/DevelopmentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,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',
Expand Down
3 changes: 1 addition & 2 deletions src/mako/http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
use function stripos;
use function strlen;
use function strpos;
use function strtok;
use function strtoupper;

/**
Expand Down Expand Up @@ -273,7 +272,7 @@ protected function determineMethod(): string
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;
Expand Down
7 changes: 3 additions & 4 deletions src/mako/utility/UUID.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -115,7 +114,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(
'%s-%s-%x-%x-%s',
Expand Down Expand Up @@ -146,7 +145,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(
'%s-%s-%x-%x-%s',
Expand Down
4 changes: 2 additions & 2 deletions src/mako/view/compilers/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -246,6 +246,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));
}
}
4 changes: 2 additions & 2 deletions src/mako/view/renderers/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

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;
Expand Down Expand Up @@ -46,7 +46,7 @@ public function __construct(
*/
protected function getCompiledPath(string $view): string
{
return "{$this->cachePath}/" . md5($view) . '.php';
return "{$this->cachePath}/" . hash('md5', $view) . '.php';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

error_reporting(E_ALL | E_STRICT);
error_reporting(E_ALL);

date_default_timezone_set('UTC');

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/syringe/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public function testHasInstanceOf(): void
$container = new Container;

$container->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));
Expand All @@ -398,7 +398,7 @@ public function testRegisterSingleton(): void
$container = new Container;

$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'));
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/view/compilers/TemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 317fe23

Please sign in to comment.