Browse Source

MySQL : Longueurs maximum des champs texte

Ajout de sécurités pour ne pas dépasser les longueurs de texte déclarées
dans MySQL (varchar ou text selon les champs)
Alexandre Alapetite 12 years ago
parent
commit
396fefeae1
1 changed files with 6 additions and 6 deletions
  1. 6 6
      app/models/Entry.php

+ 6 - 6
app/models/Entry.php

@@ -179,16 +179,16 @@ class Entry extends Model {
 	public function toArray () {
 	public function toArray () {
 		return array (
 		return array (
 			'id' => $this->id (),
 			'id' => $this->id (),
-			'guid' => $this->guid (),
-			'title' => $this->title (),
-			'author' => $this->author (),
-			'content' => $this->content (),
-			'link' => $this->link (),
+			'guid' => substr($this->guid (), 0, 65535),
+			'title' => substr($this->title (), 0, 255),
+			'author' => substr($this->author (), 0, 255),
+			'content' => substr($this->content (), 0, 65535),
+			'link' => substr($this->link (), 0, 65535),
 			'date' => $this->date (true),
 			'date' => $this->date (true),
 			'is_read' => $this->isRead (),
 			'is_read' => $this->isRead (),
 			'is_favorite' => $this->isFavorite (),
 			'is_favorite' => $this->isFavorite (),
 			'id_feed' => $this->feed (),
 			'id_feed' => $this->feed (),
-			'tags' => $this->tags (true)
+			'tags' => substr($this->tags (true), 0, 65535),
 		);
 		);
 	}
 	}
 }
 }