Closed bananacoffee closed 5 months ago
I could not reproduce.
Cannot reproduce.
@datamweb @kenjis
I was able to confirm the reproducibility. An error occurs when using CSRF filter.
// app\Config\Filters.php line 70
public array $globals = [
'before' => [
// 'honeypot',
'csrf',
// 'invalidchars',
],
'after' => [
'toolbar',
// 'honeypot',
// 'secureheaders',
],
];
Debug
// vendor\codeigniter4\framework\system\Helpers\form_helper.php line 65
var_dump(in_array('csrf', $before, true)); // true
var_dump(array_key_exists('csrf', $before)); // false
var_dump(str_contains($action, base_url())); // error
if ((in_array('csrf', $before, true) || array_key_exists('csrf', $before)) && str_contains($action, base_url()) && !stripos($form, 'method="get"')) {
$form .= csrf_field($csrfId ?? null);
}
It works when change it to
str_contains((string)$action, base_url())
Check #8736
Resolved! thank you.
No, not yet merged. This issue will be closed automatically when merged.
PHP Version
8.2
CodeIgniter4 Version
4.5.0
CodeIgniter4 Installation Method
Composer (as dependency to an existing project)
Which operating systems have you tested for this bug?
Windows
Which server did you use?
cli
Database
MariaDB 10.4
What happened?
When CSRF Filter is On. I encountered a TypeError when using the form_open(''). The error message is as follows:
Debug
Steps to Reproduce
Expected Output
<form action="current_url" method="post">
Anything else?
This issue did not occur when using CodeIgniter version 4.4.7. Any help on this issue would be greatly appreciated.