@@ -45,7 +45,7 @@ class CodeIgniter
4545 /**
4646 * The current version of CodeIgniter Framework
4747 */
48- public const CI_VERSION = '4.1.8 ' ;
48+ public const CI_VERSION = '4.1.9 ' ;
4949
5050 private const MIN_PHP_VERSION = '7.3 ' ;
5151
@@ -299,6 +299,12 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
299299
300300 $ this ->spoofRequestMethod ();
301301
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+
302308 Events::trigger ('pre_system ' );
303309
304310 // Check for a cached page. Execution will stop
@@ -352,6 +358,7 @@ public function useSafeOutput(bool $safe = true)
352358 /**
353359 * Handles the main request logic and fires the controller.
354360 *
361+ * @throws PageNotFoundException
355362 * @throws RedirectException
356363 *
357364 * @return mixed|RequestInterface|ResponseInterface
@@ -976,7 +983,10 @@ public function spoofRequestMethod()
976983 return ;
977984 }
978985
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+ }
980990 }
981991
982992 /**
0 commit comments