Bonjour à tous !
Je rencontre une erreur et je n'arrive pas à comprendre comment la corriger ni exactement ce qui la provoque ><
Version PHP : 7.0.23
Voici les deux messages d'erreurs :
Cela se passe lors de l'exécution de ce bout de code :Fatal error: Uncaught PDOException: You cannot serialize or unserialize PDO instances in [no active file] on line 0
PDOException: You cannot serialize or unserialize PDO instances in [no active file] on line 0
Les fonctions appelées :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 if(!empty($_POST['login']) && !empty($_POST['password'])) { $_SQL = SQL::getInstance(); $req = 'SELECT id, login, password FROM member WHERE login = :login'; $rep = $_SQL->prepare($req); $rep->execute(array(':login' => $_POST['login'])); $resultat = $rep->fetchAll(); if(count($resultat) == 1) { if(password_verify($_POST['password'], $resultat[0]['password'])) { // We can store some specific data in SESSION to access it easily $_SESSION['id'] = $resultat[0]['id']; // Load all member data // It's supposed to be the only SQL job until the member ask for an action // other than just show some data $member = new Member($_SESSION['id']); $member->loadAccountDataFromMemberId(); // Store the object in SESSION $_SESSION['dataMember'] = $member; // Load all game data $game = new Game(1); $game->setCategories(Categorie::loadList()); //header('Location: index.php?p=accueil'); exit(); } //header('Location: index.php?erreur=1'); exit(); } //header('Location: index.php?erreur=1'); exit(); }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 public function loadAccountDataFromMemberId() { $this->scores = Score::loadListFromMemberId($this->id); if(is_array($this->scores)) return true; return false; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 public static function loadListFromMemberId($id) { $_SQL = SQL::getInstance(); $req = 'SELECT s.id as s_id, s.valeur as s_valeur FROM scoreMember sm JOIN score s ON sm.idScore = s.id WHERE sm.idScore = :id'; $rep = $_SQL->prepare($req); $rep->execute(array(':id' => $id)); $resultat = $rep->fetchAll(); if(count($resultat) > 0) { $scores = array(); $i = 0; foreach($resultat as $score) { // We store basics data $scores[$i] = new score($score['s_id']); $scores[$i]->setValeur($score['s_valeur']); $i++; } return $scores; } return false; }
Partager