File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 99 */
1010namespace SebastianBergmann \CodeCoverage \StaticAnalysis ;
1111
12- use function crc32 ;
1312use function file_get_contents ;
1413use function file_put_contents ;
14+ use function implode ;
1515use function is_file ;
16+ use function md5 ;
1617use function serialize ;
1718use SebastianBergmann \CodeCoverage \Util \Filesystem ;
1819use SebastianBergmann \FileIterator \Facade as FileIteratorFacade ;
@@ -159,7 +160,8 @@ private function write(string $filename, $data): void
159160
160161 private function cacheFile (string $ filename ): string
161162 {
162- return $ this ->directory . DIRECTORY_SEPARATOR . hash ('sha256 ' , $ filename . crc32 (file_get_contents ($ filename )) . self ::cacheVersion ());
163+ return $ this ->directory . DIRECTORY_SEPARATOR
164+ . md5 ($ filename . "\0" . file_get_contents ($ filename ) . "\0" . self ::cacheVersion ());
163165 }
164166
165167 private static function cacheVersion (): string
@@ -168,13 +170,14 @@ private static function cacheVersion(): string
168170 return self ::$ cacheVersion ;
169171 }
170172
171- $ buffer = '' ;
173+ $ buffer = [] ;
172174
173175 foreach ((new FileIteratorFacade )->getFilesAsArray (__DIR__ , '.php ' ) as $ file ) {
174- $ buffer .= file_get_contents ($ file );
176+ $ buffer [] = $ file ;
177+ $ buffer [] = file_get_contents ($ file );
175178 }
176179
177- self ::$ cacheVersion = ( string ) crc32 ( $ buffer );
180+ self ::$ cacheVersion = md5 ( implode ( "\0" , $ buffer) );
178181
179182 return self ::$ cacheVersion ;
180183 }
You can’t perform that action at this time.
0 commit comments