File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
http/src/Session/Managers Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -81,8 +81,14 @@ private function resolve(SessionId $id): ?Session
8181 return null ;
8282 }
8383
84+ $ file_pointer = fopen ($ path , 'rb ' );
85+ flock ($ file_pointer , LOCK_SH );
86+
8487 $ content = Filesystem \read_file ($ path );
8588
89+ flock ($ file_pointer , LOCK_UN );
90+ fclose ($ file_pointer );
91+
8692 return unserialize ($ content , ['allowed_classes ' => true ]);
8793 } catch (Throwable ) {
8894 return null ;
Original file line number Diff line number Diff line change @@ -120,15 +120,7 @@ function read_file(string $filename): string
120120 throw Exceptions \PathWasNotReadable::forFile ($ filename );
121121 }
122122
123- [$ result , $ message ] = box (static function () use ($ filename ): false |string {
124- $ file_pointer = fopen ($ filename , 'rb ' );
125- flock ($ file_pointer , LOCK_SH );
126- $ contents = file_get_contents ($ filename );
127- flock ($ file_pointer , LOCK_UN );
128- fclose ($ file_pointer );
129-
130- return $ contents ;
131- });
123+ [$ result , $ message ] = box (static fn (): false |string => file_get_contents ($ filename ));
132124
133125 if (false === $ result ) {
134126 throw new Exceptions \RuntimeException (sprintf (
You can’t perform that action at this time.
0 commit comments