Skip to content

sebastian-king/mysql_unserialize_php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

-- 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;

About

User Defined Function to interpret a serialized-php object

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 92.9%
  • Makefile 7.1%