Closed
Description
PHP Version
8.1
CodeIgniter4 Version
4.5.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
MySQL 8.0.30
What happened?
Trying to set with runntime $reportURI property from app/Config/ContentSecurityPolicy.php to null in BaseController, throws an exception:
message: CodeIgniter\HTTP\ContentSecurityPolicy::setReportURI(): Argument #1 ($uri) must be of type string, null given, called in C:\laragon\www\...\app\Controllers\BaseController.php on line 70
file: C:\laragon\www\newawm\vendor\codeigniter4\framework\system\HTTP\ContentSecurityPolicy.php on line 599
This shoud happen because $reportURI from app/Config/ContentSecurityPolicy.php accept ?string. The sabe the core config file. However the propertie inside system\HTTP\ContentSecurityPolicy.php just accept strings.
__
Steps to Reproduce
- Inside BaseController -> public function initController add the following code:
if(!empty($this->session->get('system'))) { ...
// get the CSP instance
$csp = $this->response->getCSP();
$csp->setReportURI(null);
Expected Output
The CSP (from Codeigniter\HTTP\ContentSecurityPolicy) object inside the response object (Codeigniter\HTTP\Response) setted as null
Anything else?
$csp->setReportURI('null') or $csp->setReportURI('') do the job. So I can handle it in the model
Metadata
Metadata
Assignees
Labels
No labels
Activity