Skip to content

Commit c65ac53

Browse files
shawnlindstromShawn Lindstrom
and
Shawn Lindstrom
authored
Use xxh128 when comparing views for changes (#55517)
Co-authored-by: Shawn Lindstrom <[email protected]>
1 parent 9ee0795 commit c65ac53

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Illuminate/View/Compilers/BladeCompiler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ public function compile($path = null)
199199
return;
200200
}
201201

202-
$compiledHash = $this->files->hash($compiledPath, 'sha256');
202+
$compiledHash = $this->files->hash($compiledPath, 'xxh128');
203203

204-
if ($compiledHash !== hash('sha256', $contents)) {
204+
if ($compiledHash !== hash('xxh128', $contents)) {
205205
$this->files->put($compiledPath, $contents);
206206
}
207207
}

tests/View/ViewBladeCompilerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function testCompileUpdatesCacheIfChanged()
8888
$files->shouldReceive('get')->once()->with('foo')->andReturn('Hello World');
8989
$files->shouldReceive('exists')->once()->with(__DIR__)->andReturn(true);
9090
$files->shouldReceive('exists')->once()->with($compiledPath)->andReturn(true);
91-
$files->shouldReceive('hash')->once()->with($compiledPath, 'sha256')->andReturn(hash('sha256', 'outdated content'));
91+
$files->shouldReceive('hash')->once()->with($compiledPath, 'xxh128')->andReturn(hash('xxh128', 'outdated content'));
9292
$files->shouldReceive('put')->once()->with($compiledPath, 'Hello World<?php /**PATH foo ENDPATH**/ ?>');
9393
$compiler->compile('foo');
9494
}
@@ -101,7 +101,7 @@ public function testCompileKeepsCacheIfUnchanged()
101101
$files->shouldReceive('exists')->once()->with(__DIR__)->andReturn(false);
102102
$files->shouldReceive('makeDirectory')->once()->with(__DIR__, 0777, true, true);
103103
$files->shouldReceive('exists')->once()->with($compiledPath)->andReturn(true);
104-
$files->shouldReceive('hash')->once()->with($compiledPath, 'sha256')->andReturn(hash('sha256', 'Hello World<?php /**PATH foo ENDPATH**/ ?>'));
104+
$files->shouldReceive('hash')->once()->with($compiledPath, 'xxh128')->andReturn(hash('xxh128', 'Hello World<?php /**PATH foo ENDPATH**/ ?>'));
105105
$compiler->compile('foo');
106106
}
107107

0 commit comments

Comments
 (0)