@@ -45,7 +45,7 @@ class CodeIgniter
45
45
/**
46
46
* The current version of CodeIgniter Framework
47
47
*/
48
- public const CI_VERSION = '4.1.8 ' ;
48
+ public const CI_VERSION = '4.1.9 ' ;
49
49
50
50
private const MIN_PHP_VERSION = '7.3 ' ;
51
51
@@ -299,6 +299,12 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
299
299
300
300
$ this ->spoofRequestMethod ();
301
301
302
+ if ($ this ->request instanceof IncomingRequest && $ this ->request ->getMethod () === 'cli ' ) {
303
+ $ this ->response ->setStatusCode (405 )->setBody ('Method Not Allowed ' );
304
+
305
+ return $ this ->sendResponse ();
306
+ }
307
+
302
308
Events::trigger ('pre_system ' );
303
309
304
310
// Check for a cached page. Execution will stop
@@ -352,6 +358,7 @@ public function useSafeOutput(bool $safe = true)
352
358
/**
353
359
* Handles the main request logic and fires the controller.
354
360
*
361
+ * @throws PageNotFoundException
355
362
* @throws RedirectException
356
363
*
357
364
* @return mixed|RequestInterface|ResponseInterface
@@ -976,7 +983,10 @@ public function spoofRequestMethod()
976
983
return ;
977
984
}
978
985
979
- $ this ->request = $ this ->request ->setMethod ($ method );
986
+ // Only allows PUT, PATCH, DELETE
987
+ if (in_array (strtoupper ($ method ), ['PUT ' , 'PATCH ' , 'DELETE ' ], true )) {
988
+ $ this ->request = $ this ->request ->setMethod ($ method );
989
+ }
980
990
}
981
991
982
992
/**
0 commit comments