When i try to store serialized object with namespace i cant do that beacuse i got error unterminated quoted string at or near "'O:22:"protect\classes\Router". Code:
$router = new protect\classes\Router();
$tmp = serialize($router);
$dsn = 'pgsql:dbname=system;host=127.0.0.1';
$user = 'postgres';
$password = 'mypassword';
$pdo = new PDO($dsn, $user, $password, $options);
$pdo->exec('SET search_path = temporary');
$pdo->query("SELECT replace_value('protect\classes\Router','$tmp','serialized_classes')"); // this is my function it`s work fine
If i use php function addslashes before query executed for exampe
$tmp = addslashes(serialize($router));
the query is successful executed. Unfortunately serialized object with additional slashes is disorder.
I will grateful for help with this topic.