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)
81
81
throw new ExcutableFileException ();
82
82
}
83
83
84
+ if (strpos ($ extension , 'php ' ) === 0 ) {
85
+ throw new ExcutableFileException ();
86
+ }
87
+
84
88
return $ this ;
85
89
}
86
90
Original file line number Diff line number Diff line change @@ -168,6 +168,18 @@ public function testFailsExtensionIsNotExcutableWithExtensionNotLowerCase()
168
168
$ validator ->extensionIsNotExcutable (['php ' , 'html ' ]);
169
169
}
170
170
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
+
171
183
public function testFailsExtensionIsValidWithSpecialCharacters ()
172
184
{
173
185
$ uploaded_file = m::mock (UploadedFile::class);
You can’t perform that action at this time.
0 commit comments