Skip to content

Bug: Force File Download error in the latest version (4.2.3) #6358

Closed
@vachzar

Description

@vachzar

PHP Version

7.4

CodeIgniter4 Version

4.2.3

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

No response

What happened?

when I executed return $this->response->download('some.txt', 'some text', true)
it return an error below.

TypeError

Argument 1 passed to CodeIgniter\CodeIgniter::displayPerformanceMetrics() must be of the type string, null given, 
called in D:\laragon\www\iprisinsi\vendor\codeigniter4\framework\system\CodeIgniter.php on line 500 

SYSTEMPATH\CodeIgniter.php at line 740

733 
734         return md5($name);
735     }
736 
737     /**
738      * Replaces the elapsed_time tag.
739      */
740     public function displayPerformanceMetrics(string $output): string
741     {
742         return str_replace('{elapsed_time}', (string) $this->totalTime, $output);
743     }
744 
745     /**
746      * Try to Route It - As it sounds like, works with the router to
747      * match a route against the current URI. If the route is a

actually I found this when 4.2.2 released

Steps to Reproduce

just run this code on home Controller
return $this->response->download('some.txt', 'some text', true)

Expected Output

file some.txt downloaded

Anything else?

since I m new to this I couldn't point what file to fix

Metadata

Metadata

Assignees

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