From 48feadd565cb7f9c14b13bc703b685d890acb653 Mon Sep 17 00:00:00 2001 From: suddenly-eva Date: Thu, 7 Feb 2019 12:51:07 -0800 Subject: [PATCH 1/2] Match delete before update in websafe resource options, fixes /resource/(:segment)/delete mapping to update function. --- system/Router/RouteCollection.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 2d3f8ff9ba76..047ddc5cabb6 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -866,14 +866,14 @@ public function resource(string $name, array $options = null): RouteCollectionIn // Web Safe? if (isset($options['websafe'])) { - if (in_array('update', $methods)) - { - $this->post($name . '/' . $id, $new_name . '::update/$1', $options); - } if (in_array('delete', $methods)) { $this->post($name . '/' . $id . '/delete', $new_name . '::delete/$1', $options); } + if (in_array('update', $methods)) + { + $this->post($name . '/' . $id, $new_name . '::update/$1', $options); + } } return $this; From 380b9727bc42481d673c1acc740cda219fb311da Mon Sep 17 00:00:00 2001 From: Jim Parry Date: Thu, 7 Feb 2019 15:17:45 -0800 Subject: [PATCH 2/2] Fix RouteCollection resource method check --- system/Router/RouteCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 047ddc5cabb6..4083ca39b156 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -863,7 +863,7 @@ public function resource(string $name, array $options = null): RouteCollectionIn $this->delete($name . '/' . $id, $new_name . '::delete/$1', $options); } - // Web Safe? + // Web Safe? delete needs checking before update because of method name if (isset($options['websafe'])) { if (in_array('delete', $methods))