AnsweredAssumed Answered

file_exists() always returns TRUE

Question asked by Kenneth Brill on Jul 30, 2018
Latest reply on Jul 31, 2018 by Kenneth Brill

in include/utils/sugar_file_utils.php there is the code around line 105

 

if(!file_exists($filename)){
sugar_touch($filename);
}

 

file_exists is returning TRUE even if the file does not exist. So, when you press Save & Deploy, the file is read, immediately deleted in modules/ModuleBuilder/parsers/views/AbstractMetaDataImplementation.php _saveToFile(), then the system calls sugar_file_put_contents() and runs the lines above which somehow thinks the file still exists so it doesn't touch it and then it fails the is_writable() function because it, in fact, does NOT exist.

 

If I alter this code to read 

 

if(1==1){
sugar_touch($filename);
}

 

then everything works perfectly.  We are not running any SELinux clones, I reset OpCache (not sure why that would work anyway), no safe_mode (if thats a thing anymore) I have tried adding code to clearstatcache() but it still always sees the file as existing.

Outcomes