forked from junamai2000/mysql_unserialize_php
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
31 lines (27 loc) · 1.59 KB
/
README
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
-- install (debian based OSs) --
TODO: update installation instructions for latest debian packages and PHP 7
in the meantime the below works on debian-based OSs running php5.
apt-get install php5-dev libphp5-embed
cd /tmp/
wget https://github.com/sebastian-king/mysql_unserialize_php/archive/master.zip
unzip master.zip
cd mysql_unserialize_php-master/
make
cp unserialize_php.so /usr/lib/mysql/plugin/unserialize_php.so
-- examples --
mysql> CREATE FUNCTION unserialize_php RETURNS STRING SONAME 'unserialize_php.so';
mysql> SELECT unserialize_php('O:8:"stdClass":2:{s:1:"a";s:5:"hello";s:1:"b";s:5:"world";}', '$obj->a');
+-------------------------------------------------------------------------------------------+
| unserialize_php('O:8:"stdClass":2:{s:1:"a";s:5:"hello";s:1:"b";s:5:"world";}', '$obj->a') |
+-------------------------------------------------------------------------------------------+
| hello |
+-------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
mysql> SELECT unserialize_php('a:2:{i:1;s:5:"hello";i:2;s:5:"world";}', '$obj[2]');
+----------------------------------------------------------------------+
| unserialize_php('a:2:{i:1;s:5:"hello";i:2;s:5:"world";}', '$obj[2]') |
+----------------------------------------------------------------------+
| world |
+----------------------------------------------------------------------+
1 row in set (0.02 sec)
mysql> DROP FUNCTION unserialize_php;