lib/ASM/File/FileDriver.php
private function createNewSessionFile()
    {
        for ($count=0 ; $count<10 ; $count++) {
            $sessionId = $this->idGenerator->generateSessionID();
            $filename = $this->generateFilenameForDataFile($sessionId);
            //TODO remove? - the user should create the directory themselves
            $dirname = dirname($filename);
            @mkdir($dirname);
            //This only succeeds if the file doesn't already exist
            $fileHandle = @fopen($filename, 'x+');
            if ($fileHandle != false) {
                return [$sessionId, $fileHandle];
            }
        };

        throw new AsmException(
            "Failed to open a new session file with random name.",
            AsmException::ID_CLASH
        );
    }
private function createNewSessionFile()
    {
        for ($count=0 ; $count<10 ; $count++) {
            $sessionId = $this->idGenerator->generateSessionID();
            $filename = $this->generateFilenameForDataFile($sessionId);
            //TODO remove? - the user should create the directory themselves
            $dirname = dirname($filename);
            @mkdir($dirname);
            //This only succeeds if the file doesn't already exist
            $fileHandle = @fopen($filename, 'x+');
            if ($fileHandle != false) {
                return [$sessionId, $fileHandle];
            }
        };

        throw new AsmException(
            "Failed to open a new session file with random name.",
            AsmException::ID_CLASH
        );
    }
Create a new file safely.

@return array
@throws AsmException