File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,10 @@ public function extensionIsNotExcutable($excutable_extensions)
8181 throw new ExcutableFileException ();
8282 }
8383
84+ if (strpos ($ extension , 'php ' ) === 0 ) {
85+ throw new ExcutableFileException ();
86+ }
87+
8488 return $ this ;
8589 }
8690
Original file line number Diff line number Diff line change @@ -168,6 +168,18 @@ public function testFailsExtensionIsNotExcutableWithExtensionNotLowerCase()
168168 $ validator ->extensionIsNotExcutable (['php ' , 'html ' ]);
169169 }
170170
171+ public function testFailsExtensionIsNotExcutableWithExtensionsStartsWithPhp ()
172+ {
173+ $ uploaded_file = m::mock (UploadedFile::class);
174+ $ uploaded_file ->shouldReceive ('getClientOriginalExtension ' )->andReturn ('php8 ' );
175+
176+ $ validator = new LfmUploadValidator ($ uploaded_file );
177+
178+ $ this ->expectException (ExcutableFileException::class);
179+
180+ $ validator ->extensionIsNotExcutable (['php ' , 'html ' ]);
181+ }
182+
171183 public function testFailsExtensionIsValidWithSpecialCharacters ()
172184 {
173185 $ uploaded_file = m::mock (UploadedFile::class);
You can’t perform that action at this time.
0 commit comments