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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- EN-Revision: 24249 -->
<!-- Reviewed: no -->
<sect1 id="zend.serializer.adapter">
<title>Zend_Serializer_Adapter</title>
<para>
Les adaptateurs <classname>Zend_Serializer</classname> servent à changer les méthodes
de sérialisation facilement.
</para>
<para>
Chaque adaptateurs possède ses propres atouts et inconvénients. Dans certains cas, certains
types PHP (objets) ne peuvent être représentés sous forme de chaines. Dans ce cas, ces types
seront convertis vers un type sérialisable (par exemple, les objets seront convertis en tableaux).
Ci ceci échoue, une exception <classname>Zend_Serializer_Exception</classname> sera alors envoyée.
</para>
<para>
Voici une liste des adaptateurs disponibles.
</para>
<sect2 id="zend.serializer.adapter.phpserialize">
<title>Zend_Serializer_Adapter_PhpSerialize</title>
<para>
Cet adaptateur utilise les fonctions PHP <methodname>un/serialize</methodname> et
constitue un bon choix d'adaptateur par défaut.
</para>
<para>
Aucune option de configuration n'existe pour cet adaptateur.
</para>
</sect2>
<sect2 id="zend.serializer.adapter.igbinary">
<title>Zend_Serializer_Adapter_Igbinary</title>
<para>
<ulink url="http://opensource.dynamoid.com">Igbinary</ulink> est un logiciel
Open Source crée par Sulake Dynamoid Oy. C'est un remplaçant du sérialiseur utiliser
par PHP. Au lieu d'utiliser une représentation textuelle (couteuse en temps et en poids),
igbinary représente les structures de données PHP dans un format binaire compact.
Les gains sont importants lorsqu'un système de stockage comme memcache est utilisé
pour les données sérialisées.
</para>
<para>
L'extension PHP igbinary est requise pour l'utilisation de cet adaptateur.
</para>
<para>
Aucune option de configuration n'existe pour cet adaptateur.
</para>
</sect2>
<sect2 id="zend.serializer.adapter.wddx">
<title>Zend_Serializer_Adapter_Wddx</title>
<para>
<ulink url="http://wikipedia.org/wiki/WDDX">WDDX</ulink> (Web Distributed Data eXchange)
est à la fois un langage de programmation, une plateforme et un mecanisme de transport
de données entre différents environnements.
</para>
<para>
Cet adaptateur utilise simplement les fonctions PHP
<ulink url="http://php.net/manual/book.wddx.php">wddx_*()</ulink>. Veuillez lire
le manuel PHP afin de vérifier la disponibilité et l'installation de ces fonctions.
</para>
<para>
Aussi, l'extension PHP <ulink
url="http://php.net/manual/book.simplexml.php">SimpleXML</ulink> est utilisée
pour vérifier si une valeur <constant>NULL</constant> retournée par
<methodname>wddx_unserialize()</methodname> est basée sur une donnée sérialisée
<constant>NULL</constant> ou au contraire des données non valides
</para>
<para>
Les options disponibles sont:
</para>
<table id="zend.serializer.adapter.wddx.table.options">
<title>Options Zend_Serializer_Adapter_Wddx</title>
<tgroup cols="4">
<thead>
<row>
<entry>Option</entry>
<entry>Type de donnée</entry>
<entry>Valeur par défaut</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>comment</emphasis></entry>
<entry><type>chaine</type></entry>
<entry></entry>
<entry>
Un commentaire qui apparait dans l'en-tête du paquet.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="zend.serializer.adapter.json">
<title>Zend_Serializer_Adapter_Json</title>
<para>
L'adaptateur <acronym>JSON</acronym> acréer un pont vers
<classname>Zend_Json</classname> et/ou ext/json (l'extension json de PHP).
Pour plus d'informations, lisez le manuel de <link
linkend= "zend.json.introduction">Zend_Json</link>.
</para>
<para>
Les options disponibles sont:
</para>
<table id="zend.serializer.adapter.json.table.options">
<title>Options Zend_Serializer_Adapter_Json</title>
<tgroup cols="4">
<thead>
<row>
<entry>Option</entry>
<entry>Type de donnée</entry>
<entry>Valeur par défaut</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>cycleCheck</emphasis></entry>
<entry><type>booléen</type></entry>
<entry>false</entry>
<entry>
Voyez
<link linkend="zend.json.advanced.objects1">cette section</link>
</entry>
</row>
<row>
<entry><emphasis>objectDecodeType</emphasis></entry>
<entry><type>Zend_Json::TYPE_*</type></entry>
<entry>Zend_Json::TYPE_ARRAY</entry>
<entry>
Voyez
<link linkend= "zend.json.advanced.objects1">this section</link>
</entry>
</row>
<row>
<entry><emphasis>enableJsonExprFinder</emphasis></entry>
<entry><type>booléen</type></entry>
<entry>false</entry>
<entry>
Voyez <xref linkend= "zend.json.advanced.expr"/>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="zend.serializer.adapter.amf03">
<title>Zend_Serializer_Adapter_Amf 0 et 3</title>
<para>
Les adaptateurs <acronym>AMF</acronym>, <classname>Zend_Serializer_Adapter_Amf0</classname>
et <classname>Zend_Serializer_Adapter_Amf3</classname>, sont un pont vers le sérialiseur
du composant <classname>Zend_Amf</classname>. Veuillez lire la documentation de <link
linkend= "zend.amf.introduction">Zend_Amf documentation</link> pour plus
d'informations.
</para>
<para>
Aucune option de configuration n'existe pour cet adaptateur.
</para>
</sect2>
<sect2 id="zend.serializer.adapter.pythonpickle">
<title>Zend_Serializer_Adapter_PythonPickle</title>
<para>
Cet adaptateur convertit des types PHP vers une chaine <ulink
url="http://docs.python.org/library/pickle.html">Python Pickle</ulink>
Grâce à lui, vous pouvez lire en Python des données sérialisées de PHP et
inversement.
</para>
<para>
Les options disponibles sont:
</para>
<table id="zend.serializer.adapter.pythonpickle.table.options">
<title>Options Zend_Serializer_Adapter_PythonPickle</title>
<tgroup cols="4">
<thead>
<row>
<entry>Option</entry>
<entry>Type de donnée</entry>
<entry>Valeur par défaut</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>protocol</emphasis></entry>
<entry><type>entier</type> (0 | 1 | 2 | 3)</entry>
<entry>0</entry>
<entry>
La version du protocole Pickle pour <methodname>serialize</methodname>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Le transtypage (PHP vers Python) se comporte comme suit:
</para>
<table id="zend.serializer.adapter.pythonpickle.table.php2python">
<title>Le transtypage (PHP vers Python)</title>
<tgroup cols="2">
<thead>
<row>
<entry>Type PHP</entry>
<entry>Type Python</entry>
</row>
</thead>
<tbody>
<row>
<entry><type>NULL</type></entry>
<entry><type>None</type></entry>
</row>
<row>
<entry><type>booléen</type></entry>
<entry><type>booléen</type></entry>
</row>
<row>
<entry><type>entier</type></entry>
<entry><type>entier</type></entry>
</row>
<row>
<entry><type>flottant</type></entry>
<entry><type>flottant</type></entry>
</row>
<row>
<entry><type>chaine</type></entry>
<entry><type>chaine</type></entry>
</row>
<row>
<entry><type>tableau</type></entry>
<entry><type>liste</type></entry>
</row>
<row>
<entry><type>tableau associatif</type></entry>
<entry><type>dictionnaire</type></entry>
</row>
<row>
<entry><type>objet</type></entry>
<entry><type>dictionnaire</type></entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Le transtypage (Python vers PHP) se comporte comme suit:
</para>
<table id="zend.serializer.adapter.pythonpickle.table.python2php">
<title>Transtypage (Python vers PHP):</title>
<tgroup cols="2">
<thead>
<row>
<entry>Type Python</entry>
<entry>Type PHP</entry>
</row>
</thead>
<tbody>
<row>
<entry><type>None</type></entry>
<entry><type>NULL</type></entry>
</row>
<row>
<entry><type>booléen</type></entry>
<entry><type>booléen</type></entry>
</row>
<row>
<entry><type>entier</type></entry>
<entry><type>entier</type></entry>
</row>
<row>
<entry><type>long</type></entry>
<entry>
<type>entier</type>
| <type>flottant</type>
| <type>chaine</type>
| <classname>Zend_Serializer_Exception</classname>
</entry>
</row>
<row>
<entry><type>flottant</type></entry>
<entry><type>flottant</type></entry>
</row>
<row>
<entry><type>chaine</type></entry>
<entry><type>chaine</type></entry>
</row>
<row>
<entry><type>octets</type></entry>
<entry><type>chaine</type></entry>
</row>
<row>
<entry><type>chaine Unicode</type></entry>
<entry><type>chaine UTF-8</type></entry>
</row>
<row>
<entry><type>list</type></entry>
<entry><type>tableau</type></entry>
</row>
<row>
<entry><type>tuple</type></entry>
<entry><type>tableau</type></entry>
</row>
<row>
<entry><type>dictionnaire</type></entry>
<entry><type>tableau associatif</type></entry>
</row>
<row>
<entry>Tout autre type</entry>
<entry><classname>Zend_Serializer_Exception</classname></entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="zend.serializer.adapter.phpcode">
<title>Zend_Serializer_Adapter_PhpCode</title>
<para>
Cet adaptateur génère une chaine représentant du code analysable par PHP via <ulink
url="http://php.net/manual/function.var-export.php">var_export()</ulink>.A la
désérialisation, les données seront exécutées par <ulink
url="http://php.net/manual/function.eval.php">eval</ulink>.
</para>
<para>
Aucune option de configuration n'existe pour cet adaptateur.
</para>
<warning>
<title>Désérialiser des objets</title>
<para>
Les objets seront sérialisés en utilisant la méthode magique<ulink
url="http://php.net/manual/language.oop5.magic.php#language.oop5.magic.set-state">__set_state</ulink>
Si la classe ne propose pas cette méthode, une erreur fatale aboutira.
</para>
</warning>
<warning>
<title>Utilisation de eval()</title>
<para>
L'adaptateur <classname>PhpCode</classname> utilise <methodname>eval()</methodname>
pour désérialiser. Ceci mène à des problèmes de performance et de sécurité, un nouveau processus
sera crée. Typiquement, vous devriez utiliser l'adaptateur
<methodname>PhpSerialize</methodname> à moins que vous ne vouliez que les données sérialisées
ne soient analysables à l'oeil humain.
</para>
</warning>
</sect2>
</sect1>
<!--
vim:se ts=4 sw=4 et:
-->
|