title: Uncaught ErrorException: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated codeigniter
body: <p>I'm running codeigniter 4.1.5 and php 8.1.0 and when i try to input data this is the error i got</p>
  <p>Uncaught ErrorException: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in C:\xampp\htdocs\cikaryawan\system\Validation\FormatRules.php:253
  Stack trace:</p>
  <ol>
  <li>#0 [internal function]: CodeIgniter\Debug\Exceptions-&gt;errorHandler()</li>
  <li>#1 C:\xampp\htdocs\cikaryawan\system\Validation\FormatRules.php(253):
  strtolower()</li>
  <li>#2 C:\xampp\htdocs\cikaryawan\system\HTTP\RequestTrait.php(151): CodeIgniter\Validation\FormatRules-&gt;valid_ip()</li>
  <li>#3 C:\xampp\htdocs\cikaryawan\app\Views\errors\html\error_exception.php(206):
  CodeIgniter\HTTP\Request-&gt;getIPAddress()</li>
  <li>#4 C:\xampp\htdocs\cikaryawan\system\Debug\Exceptions.php(229): include('...')</li>
  <li>#5 C:\xampp\htdocs\cikaryawan\system\Debug\Exceptions.php(232): CodeIgniter\Debug\Exceptions-&gt;CodeIgniter\Debug{closure}()</li>
  <li>#6 C:\xampp\htdocs\cikaryawan\system\Debug\Exceptions.php(116): CodeIgniter\Debug\Exceptions-&gt;render()</li>
  <li>#7 [internal function]: CodeIgniter\Debug\Exceptions-&gt;exceptionHandler()</li>
  <li>#8 {main}
  in my .env folder</li>
  </ol>
  <pre><code> CI_ENVIRONMENT = development
   database.default.hostname = localhost
   database.default.database = cikaryawanauth
   database.default.username = root
   database.default.password = 
   database.default.DBDriver = MySQLi
   database.default.DBPrefix =
  </code></pre>
  <p>this is my register.php</p>
  <pre><code>&lt;body&gt;
  
      &lt;div class=&quot;container&quot;&gt;
          &lt;div class=&quot;row&quot; style=&quot;margin-top:45px&quot;&gt;
              &lt;div class=&quot;col-md-4 col-md-offset-4&quot;&gt;
                  &lt;h4&gt;Sign Up&lt;/h4&gt;
                  &lt;hr&gt;
                  &lt;form action=&quot;&lt;?= base_url('auth/save') ?&gt;&quot; method=&quot;post&quot;&gt;
                      &lt;?= csrf_field(); ?&gt;
                      &lt;div class=&quot;form-group&quot;&gt;
                          &lt;label for=&quot;&quot;&gt;Name&lt;/label&gt;
                          &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;name&quot; placeholder=&quot;Enter your name&quot; value=&quot;&lt;?= set_value('name'); ?&gt;&quot;&gt;
                          &lt;span class=&quot;text-danger&quot;&gt;&lt;?= isset($validation) ? display_error($validation, 'name') : '' ?&gt;&lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;form-group&quot;&gt;
                          &lt;label for=&quot;&quot;&gt;Email&lt;/label&gt;
                          &lt;input type=&quot;email&quot; class=&quot;form-control&quot; name=&quot;email&quot; placeholder=&quot;Enter your email&quot; value=&quot;&lt;?= set_value('email'); ?&gt;&quot;&gt;
                          &lt;span class=&quot; text-danger&quot;&gt;&lt;?= isset($validation) ? display_error($validation, 'email') : '' ?&gt;&lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;form-group&quot;&gt;
                          &lt;label for=&quot;&quot;&gt;Password&lt;/label&gt;
                          &lt;input type=&quot;password&quot; class=&quot;form-control&quot; name=&quot;password&quot; placeholder=&quot;Enter password&quot;&gt;
                          &lt;span class=&quot;text-danger&quot;&gt;&lt;?= isset($validation) ? display_error($validation, 'password') : '' ?&gt;&lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;form-group&quot;&gt;
                          &lt;label for=&quot;&quot;&gt;Confirm Password&lt;/label&gt;
                          &lt;input type=&quot;password&quot; class=&quot;form-control&quot; name=&quot;cpassword&quot; placeholder=&quot;Confirm password&quot;&gt;
                          &lt;span class=&quot;text-danger&quot;&gt;&lt;?= isset($validation) ? display_error($validation, 'cpassword') : '' ?&gt;&lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;form-group&quot;&gt;
                          &lt;button class=&quot;btn btn-primary btn-block&quot; type=&quot;submit&quot;&gt;Sign Up&lt;/button&gt;
                      &lt;/div&gt;
                      &lt;a href=&quot;&lt;?= site_url('auth/') ?&gt;&quot;&gt;I already have account, login now&lt;/a&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/body&gt;
  </code></pre>
  <p>this is my auth.php as controller</p>
  <pre><code>&lt;?php
  
  namespace App\Controllers;
  
  class Auth extends BaseController
  {
      public function __construct()
      {
          helper(['url', 'form']);
      }
      public function index()
      {
          return view('auth/login');
      }
      public function register()
      {
          return view('auth/register');
      }
      public function save()
      {
          $validation = $this-&gt;validate([
              'name' =&gt; [
                  'rules' =&gt; 'required',
                  'errors' =&gt; [
                      'required' =&gt; 'Your name is required'
                  ]
              ],
              'email' =&gt; [
                  'rules' =&gt; 'required|valid_emails|is_unique[users.email]',
                  'errors' =&gt; [
                      'required' =&gt; 'Email is required',
                      'valid_email' =&gt; 'You must enter a valid email',
                      'is_unique' =&gt; 'Email already taken'
                  ]
              ],
              'password' =&gt; [
                  'rules' =&gt; 'required|min_length[5]|max_length[12]',
                  'errors' =&gt; [
                      'required' =&gt; 'Password is required',
                      'min_lenght' =&gt; 'Password must have atleast 5 character',
                      'max_lenght' =&gt; 'Password must not exceed 12 character'
                  ]
              ],
              'cpassword' =&gt; [
                  'rules' =&gt; 'required|min_length[5]|max_length[12]|matches[password]',
                  'errors' =&gt; [
                      'required' =&gt; 'Password is required',
                      'min_lenght' =&gt; 'Password must have atleast 5 character',
                      'max_lenght' =&gt; 'Password must not exceed 12 character',
                      'matches' =&gt; 'Confirms password not matches to password'
                  ]
              ]
          ]);
  
          if (!$validation) {
              return view('auth/register', ['validation' =&gt; $this-&gt;validator]);
          } else {
              $name = $this-&gt;request-&gt;getPost('name');
              $email = $this-&gt;request-&gt;getPost('email');
              $password = $this-&gt;request-&gt;getPost('password');
  
              $values = [
                  'name' =&gt; $name,
                  'email' =&gt; $email,
                  'password' =&gt; $password,
              ];
              $userModels = new \App\Models\UsersModel();
              $query = $userModels-&gt;insert($values);
              if (!$query) {
                  return redirect()-&gt;back()-&gt;with('fail', 'something went wrong');
              } else {
                  return redirect()-&gt;to('register')-&gt;with('success', 'You are now registered');
              }
          }
      }
  }
  </code></pre>
  <p>this is what i put in form_helper.php in helpers folder</p>
  <pre><code>&lt;?php
  function display_error($validation, $field)
  {
      if ($validation-&gt;hasError($field)) {
          return $validation-&gt;getError($field);
      } else {
          return false;
      }
  }
  </code></pre>
  <p>what did i do wrong?</p>