Some rows in a database table contains serialized data in a column:
select * from phpbb_config where config_name like 'convert%';
+-------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+------------+
| config_name | config_value | is_dynamic |
+-------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+------------+
| convert_db_server | a:4:{s:4:\"dbms\";s:22:\"phpbb\\db\\driver\\mysqli\";s:6:\"dbhost\";s:9:\"127.0.0.1\";s:6:\"dbport\";s:0:\"\";s:6:\"dbname\";s:10:\"klein-putz\";} | 1 |
| convert_db_user | a:2:{s:6:\"dbuser\";s:4:\"root\";s:8:\"dbpasswd\";s:0:\"\";} | 1 |
| convert_options | a:2:{s:10:\"forum_path\";s:16:\"../../klein-putz\";s:7:\"refresh\";i:0;} | 1 |
| convert_progress | a:3:{s:4:\"step\";s:0:\"\";s:12:\"table_prefix\";s:6:\"phpbb_\";s:3:\"tag\";s:7:\"phpbb20\";} | 1 |
+-------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+------------+
When unserialized though, all return false, rather than set a number of array elements, which suggests they are not properly serialized values.
The lines of code can be seen here:
I have heard that when you serialize something, it is basically JSON. I ran these through a JSON validator and they all fail. It's just unclear why.
You have extra backslashes in your database string.
Try this code:
As you can see $data1 is de serialized correctly, but $data2 returns false.