Skip to content

redirect($namedRoute) missing helpful exception #1953

Description

@MGatner

Passing an invalid named route to redirect() causes a type error:

SYSTEMPATH/Router/RouteCollection.php at line 1117
ltrim() expects parameter 1 to be string, object given
...
1115                 // Lose any namespace slash at beginning of strings
1116                 // to ensure more consistent match.
1117                 $to     = ltrim($to, '\\');

This should be throwing something helpful, like HTTPException::forInvalidRedirectRoute. Tested with and without custom route definitions.

  • PHP: 7.2.16
  • CodeIgniter: 4.0.0-beta.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions