You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To persist the satis config file you use this function from src/Playbloom/Satisfy/Model/FilePersister.php:
protectedfunctiondumpFile($filename, $content)
{
$handle = fopen($filename, 'r+');
if (!$handle) {
thrownewIOException(sprintf('Failed to open file "%s" for write', $filename), 0, null, $filename);
}
$locked = flock($handle, LOCK_EX | LOCK_NB);
if (!$locked) {
thrownewIOException(sprintf('Failed to lock file "%s"', $filename), 0, null, $filename);
}
ftruncate($handle);
fwrite($handle, $content);
fclose($handle);
}
But I think there is a problem with the used file mode $handle = fopen($filename, 'r+'); because it can leads to malformed json, because this mode *does not * empty the file before writing.
Actually, when i try to delete a repository from my satis.json file I get this king of error:
RuntimeException in JsonDeserializationVisitor.php line 43:
Could not decode JSON, syntax error - malformed JSON.
Hi !
To persist the satis config file you use this function from
src/Playbloom/Satisfy/Model/FilePersister.php
:But I think there is a problem with the used file mode
$handle = fopen($filename, 'r+');
because it can leads to malformed json, because this mode *does not * empty the file before writing.Actually, when i try to delete a repository from my
satis.json
file I get this king of error:And JSON config file
This is because my new content is smaller than the previous file content.
You should try using
w+
option to empty the file before writing, I think !!Thx for your work !! :)
The text was updated successfully, but these errors were encountered: