Skip to content

Bug: 'method' is an empty string in PATH_INFO causes Unhandled Exception #2965

Description

@willnode

Describe the bug

When running php spark serve, I noticed that if I set this to PATH_INFO

public $uriProtocol = 'REQUEST_URI';

And navigate to URL localhost:8080/home/, causes ErrorException: Unitialized string offset: 0 in

if (! class_exists($this->controller, true) || $this->method[0] === '_')

Because $this->method is "".

CodeIgniter 4 version
Version 4.0.3 release (in latest develop, it's just shows 404 page, skipping the actual error and throws PageNotFoundException::forMethodNotFound, probably because recent changes in error reporting level? sorry I forgot that by default CI is in production mode)

Affected module(s)
None, I think.

Expected behavior, and steps to reproduce if appropriate
It should render the same page as localhost:8080/ or localhost:8080/home/index

Context

  • OS: Windows 10 64 bit
  • PHP version 7.3.9

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

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions