mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-05 17:21:16 +02:00
BUGFIX #5157 If paths are longer than 255 characters, fopen() produces an "Invalid argument" error, shorten the paths by using basename() instead of realpath() on the manifest filename when producing the cache path in ManifestBuilder
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@100861 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
3705809ce6
commit
12d1ea9edb
@ -418,7 +418,7 @@ class ManifestBuilder {
|
||||
// We use an MD5 of the file as a part of the cache key because using datetime caused problems when users
|
||||
// were upgrading their sites
|
||||
$fileMD5 = md5($file);
|
||||
$parseCacheFile = TEMP_FOLDER . "/manifestClassParse-" . str_replace(array("/",":", "\\"),"_", realpath($filename)) . "-$fileMD5";
|
||||
$parseCacheFile = TEMP_FOLDER . "/manifestClassParse-" . str_replace(array("/", ":", "\\", "."), "_", basename($filename)) . "-$fileMD5";
|
||||
if(!file_exists($parseCacheFile)) {
|
||||
$tokens = token_get_all($file);
|
||||
$classes = self::getClassDefParser()->findAll($tokens);
|
||||
@ -427,7 +427,8 @@ class ManifestBuilder {
|
||||
$cacheContent = '<?php
|
||||
$classes = ' . var_export($classes,true) . ';
|
||||
$interfaces = ' . var_export($interfaces,true) . ';';
|
||||
if($fh = fopen($parseCacheFile,'w')) {
|
||||
|
||||
if($fh = fopen($parseCacheFile,'wb')) {
|
||||
fwrite($fh, $cacheContent);
|
||||
fclose($fh);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user