note 124392 rejected from function.addslashes by cmb
| From: | cmb@php.net | Date: | Wed, 13 Nov 2019 14:44:47 +0000 |
| Subject: | note 124392 rejected from function.addslashes by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213052@lists.php.net to get a copy of this message | ||
Note Submitter: fmr at free dot fr
----
incompatibility between the use of addslashes () and serialize ()
$tab['1']['5'] = addslashes("d'accord");
$SQL_tab = serialize($tab);
...
Reread
...
$tab = unserialize($enrg['$SQL_tab ']);
==> gives an empty array
-------------------------------------------------------
Solution with an improbability char like '£':
$tab['1']['5'] = "d'accord";
$tab['1']['5'] = strtr( $tab['1']['5'], "'",
"£");
$SQL_tab = serialize($tab);
...
Reread
...
$tab = unserialize($enrg['$SQL_tab ']);
$tab['1']['5'] = strtr( $tab['1']['5'], "£",
"'");
Frederic