diff --git a/app/controllers/studip_controller.php b/app/controllers/studip_controller.php index 2966f3c02f191b16aa9fb9bc8c6fac9e8f616859..f2eb023695545d90510445bc83c651bc632046b8 100644 --- a/app/controllers/studip_controller.php +++ b/app/controllers/studip_controller.php @@ -263,10 +263,10 @@ abstract class StudipController extends Trails_Controller // Try to create route if none given if ($to === '') { - $to = $this->parent_controller + $args[0] = $this->parent_controller ? $this->parent_controller->current_action : $this->current_action; - return $this->action_url($to); + return $this->action_url(...$args); } // Create url for a specific action diff --git a/tests/unit/lib/classes/StudipControllerTest.php b/tests/unit/lib/classes/StudipControllerTest.php index f74eae4140f1af54aae3b6265c348e09716d7072..5ded34ec12218622ed12ef2de99197a2b0537338 100644 --- a/tests/unit/lib/classes/StudipControllerTest.php +++ b/tests/unit/lib/classes/StudipControllerTest.php @@ -243,6 +243,7 @@ final class StudipControllerTest extends Codeception\Test\Unit { return [ '0-action' => ['dispatch.php/studip_controller_test/foo'], + '0-action-and-parameter' => ['dispatch.php/studip_controller_test/foo?bar=42', '', ['bar' => 42]], '1-action' => ['dispatch.php/foo', 'foo'], '1-action-and-parameter' => ['dispatch.php/foo?bar=42', 'foo', ['bar' => 42]], '1-action-and-parameters' => ['dispatch.php/foo?bar=42&baz=23', 'foo', ['bar' => 42, 'baz' => 23]],