diff --git a/app/controllers/studip_controller.php b/app/controllers/studip_controller.php index 869d8a9dd05f65edfd9024e62ae603d7aab97397..5e9ab358908aebff9a6382672e5305dce8469aec 100644 --- a/app/controllers/studip_controller.php +++ b/app/controllers/studip_controller.php @@ -257,10 +257,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 532116677ae115810f20a2a15750318d1a9eaafe..4752ef06af18507ee7900966be2495a636b29313 100644 --- a/tests/unit/lib/classes/StudipControllerTest.php +++ b/tests/unit/lib/classes/StudipControllerTest.php @@ -197,6 +197,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]],