mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00: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 (from r100861)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@108814 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c57728a8d9
commit
ccda3bbc20
@ -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…
x
Reference in New Issue
Block a user