I am using wordpress's API and some parts of the objects are stored as serialized strings. I am not using PHP to extract this data, I want to write this logic in another language (Python/C++). Is there an explaination as to how PHP's unserialize function works? If some can provide code/psuedocode for doing this would be very helpful.
Asked
Active
Viewed 322 times
0
-
2Does this answer your question? [Structure of a Serialized PHP string](https://stackoverflow.com/questions/14297926/structure-of-a-serialized-php-string) – zeterain Jul 15 '20 at 15:25
-
There's a python library just for that, https://pypi.org/project/phpserialize/, and also a couple of older questions addressing this: [Unserialize PHP data in python](https://stackoverflow.com/questions/5935501/unserialize-php-data-in-python), [How to read/make sense of a PHP serialised data string in python](https://stackoverflow.com/questions/5408599/how-to-read-make-sense-of-a-php-serialised-data-string-in-python). – Markus AO Jul 15 '20 at 19:51
-
Then there's also the [PHP's C source code for `unserialize()`](https://git.php.net/?p=php-src.git;a=blob;f=ext/standard/var_unserializer.re;h=a444cdef5b7e7f34767e64f10c5529817c186469;hb=1806ce9cb019ee74ddb540cbc07daf121dcb5537) for reference, if you really want to implement it yourself. – Markus AO Jul 15 '20 at 19:51