File tree Expand file tree Collapse file tree 1 file changed +1
-15
lines changed Expand file tree Collapse file tree 1 file changed +1
-15
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,6 @@ class JsonFile
1717 */
1818 public function read ($ file )
1919 {
20- // Sanitize the file path
21- $ file = realpath ($ file );
22-
23- if ($ file === false || strpos ($ file , __DIR__ ) !== 0 ) {
24- throw new \Exception ('Invalid file path ' );
25- }
26-
2720 $ contents = file_exists ($ file ) ? file_get_contents ($ file ) : '[] ' ;
2821 return json_decode ($ contents , true );
2922 }
@@ -37,14 +30,7 @@ public function read($file)
3730 */
3831 public function write ($ file , $ data )
3932 {
40- // Sanitize the file path
41- $ file = realpath ($ file );
42-
43- if ($ file === false || strpos ($ file , __DIR__ ) !== 0 ) {
44- throw new \Exception ('Invalid file path ' );
45- }
46-
4733 file_put_contents ($ file , json_encode ($ data ));
4834 }
4935}
50- ?>
36+ ?>
You can’t perform that action at this time.
0 commit comments