w klasie bazowej użytkownika mam:
<?php public function __construct($rbx_db, string $nick, string $email) { #inicjacja połaczenia AdoDB poprzez wyłołanie konstruktora rodzica parent::__construct($rbx_db); /* wycęty kod */ } else throw new UserException(CUE_NICK_EMPTY); } else throw new UserException(CUE_EMAIL_EMPTY); } ?>
w skypcie pobierającym dane z forumularza mam wywołąnie tego konstruktora w linii numer 6 (listing poniżej). Parser wywala mi taki błąd
Kod
Fatal error: Argument 2 must be an object of class string in C:\usr\krasnal\www\robotECS\classes\user.php on line 120
Uwaga: tutaj jest to linia numer 3 w listingu wyżej.
Dlaczego tak się dzieje mimo tego, że wartości wpisane w pole formularza są stringiem?
<?php if (!$error_found) { //if every field is set try { $user = new User($rbx_db, $_POST["reg_nick"],$_POST["reg_email"]); $user->setName($_POST["reg_fname"]." ".$_POST["reg_lname"]); $user->setPassword($_POST["reg_pass"]); $user->setGG($_POST["reg_gg"]); $user->setPhone($_POST["reg_phone"]); $user->setPhoto($_POST["reg_photo"]); $user->setIcq($_POST["reg_icq"]); $user->setTlenId($_POST["reg_tlen_id"]); //$user->setDescription(""); $user->createUserSQL(1/* getLastUserID()*/); $correct = true; } catch (UserException $e){ switch ($e->getMessage()) { /* wyciety kod */ } $e_msg .= $e->getMessage(); } catch (IllegalDataException $e) { switch ($e->getMessage()) { /* wyciety kod */ } $e_msg .= $e->getMessage(); } catch (SqlException $e) { switch ($e->getMessage()) { /* wyciety kod */ } $e_msg .= $e->getMessage(); } catch (Exception $e) { } } ?>