Skip to content

Bug: cli request is confusing #7339

@itisjoby

Description

@itisjoby

PHP Version

8.2

CodeIgniter4 Version

4.1.3

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Database

Mongodb

What happened?

calling a webpage via cli is a pain in ci4. we faced a lot of issues when tried running a phpcode via terminal.

  1. i had a fatal error in my initController function of parent class.but this was not shown to me instead it stopped the execution at my __destruct function complaining different issue.it took me a lot of time to identify the real problem
  2. $this->request->uri is public in normal request(via browser) . but when running via a terminal it throws error Cannot access protected property CodeIgniter\HTTP\CLIRequest::$uri

Steps to Reproduce

ParentController.php.txt
Test.php.txt

(please rename the extension to .php as it wont allow me to upload this files)
run test.php

Expected Output

  1. run via terminal/browser getting error at __destruct . it should have stoped at initcontroller right?
  2. comment the line
    $this->dd(); //no such function fatal error
    run via terminal it should be working like running via a browser. now getting error: Cannot access protected property CodeIgniter\HTTP\CLIRequest::$uri

Anything else?

please suggest whether this was an error

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