title: Codeigniter, PHP constructor - missing argument even if it is present
body: <p>I am getting such a warning:</p>
  
  <pre><code>A PHP ERROR WAS ENCOUNTERED
  Severity: Warning
  Message: Missing argument 1 for User_model::__construct(), called in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\CI_PP\system\core\Loader.php on line 303 and defined
  Filename: models/user_model.php
  Line Number: 20
  </code></pre>
  
  <p>while running app in CodeIgniter, NetBeans, PHP 5.4. </p>
  
  <p>This is the code of models/user_model.php(playing around, ignore avoiding OOP principles, please):</p>
  
  <pre><code>&lt;?php
  
    class User_model extends MY_Model {
  
      public $_table = 'pp_user';
      public $primary_key = 'u_id';
      public $firstname;
      public $lastname;
      public $emailAddress;
      public $password;
      public $gender;
      public $deliveryAddress;
      public $address;
      public $city;
      public $zip;
      public $country;
      public $isAdmin;
  
  //this is line nr.20:
      public function __construct($firstname, $lastname, $emailAddress, $password, $gender, $address, $deliveryAddress, $city, $zip, $country, $isAdmin) {
          parent::__construct();
  
          $this-&gt;firstname = $firstname;
          $this-&gt;lastname = $lastname;
          $this-&gt;emailAddress = $emailAddress;
          $this-&gt;password = $password; //TODO!
          if ($gender == 'male') {
              $this-&gt;gender = 0;
          } else if ($gender == 'female') {
              $this-&gt;gender = 1;
          } else {
              $this-&gt;gender = -1;
          }
          $this-&gt;deliveryAddress = $deliveryAddress;
          $this-&gt;address = $address;
          $this-&gt;city = $city;
          $this-&gt;zip = $zip;
          $this-&gt;country = $country;
          $this-&gt;isAdmin = $isAdmin;
      }
  }
  </code></pre>
  
  <p>I am calling constructor in registration.php(controller):</p>
  
  <pre><code>            $firstname = $this-&gt;input-&gt;post('tf_first_name');
          $lastname = $this-&gt;input-&gt;post('tf_last_name');
          $emailAddress = $this-&gt;input-&gt;post('tf_email_address');
          $password = $this-&gt;input-&gt;post('tf_password_base');
          $gender = $this-&gt;input-&gt;post('tf_gender');
          $address = $this-&gt;input-&gt;post('tf_address');
          $deliveryAddress = $this-&gt;input-&gt;post('tf_delivery_addres');
          $city = $this-&gt;input-&gt;post('tf_city');
          $zip = $this-&gt;input-&gt;post('tf_zip');
          $country = $this-&gt;input-&gt;post('tf_country');
          $isAdmin = FALSE;
  
  
          $user_instance = new User_model(
                          $firstname,
                          $lastname,
                          $emailAddress,
                          $password,
                          $gender,
                          $address,
                          $deliveryAddress,
                          $city,
                          $zip,
                          $country,
                          $isAdmin);
  </code></pre>
  
  <p>If I change contor arguments from:</p>
  
  <pre><code>public function __construct($firstname, $lastname, $emailAddress, $password, $gender, $address, $deliveryAddress, $city, $zip, $country, $isAdmin) 
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>public function __construct($firstname="", $lastname="", ...) {
  </code></pre>
  
  <p>then it works, but I do not like such a solution. I have been searching for a hints all over the web but according to PHP OOP tutorials and PHP manual it looks ok.</p>
  
  <p>Loader.php on line 303 is doing this:</p>
  
  <pre><code>$CI-&gt;$name = new $model();
  </code></pre>
  
  <p>I tried to changed parameters to direct ones when instantiating object, I tried to remove relation to parent class but the problem remains the same. </p>
  
  <p>I am really curious what might be the problem, any idea?</p>