Welcome Guest, Not a member yet? Register   Sign In
problem with escape and objects in sessions
#1

[eluser]helle[/eluser]
hello,

fyi: i installed ecko-sessions, which i like quite much by the way.

i try to put an object into the session. the problem is my object after serialization (by native php function serialize) looks something like this:
Code:
search_parameters|s:244:"O:16:"SearchParameters":1:{s:28:"SearchParametersparameters";a:1:{s:8:"location";O:8:"stdClass":2:{s:11:"communities";a:6:{i:0;i:4;i:1;i:10;i:2;i:2032;i:3;i:1066;i:4;i:538;i:5;i:618;}s:18:"selected_provinces";a:3:{i:0;i:2;i:1;i:3;i:2;i:4;}}}}";

but after the call
Code:
$this->CI->db->escape($session_data);

its been cut and left behind is this :-(
Code:
'search_parameters|s:244:"O:16:"SearchParameters":1:{s:28:"'

can anybody help me?

thanks and regards
helle
#2

[eluser]WanWizard[/eluser]
Why do you think there's a need to manually escape session data?
#3

[eluser]helle[/eluser]
this is what ecko does before writing it into the db ...
#4

[eluser]WanWizard[/eluser]
Which database driver are you using, as the escape() method is specific to that driver?

When I take your example and run it through the escape() method here (mysqli driver), I don't see any truncation. Where did you check the result? In the code? In the database?
#5

[eluser]helle[/eluser]
Hi,

i am using the postgresql driver.
the output i checked in the database and i also printed it out for testing bevore and after the escape method ... which i posted here.
#6

[eluser]helle[/eluser]
arglh ... found the problem

if you try to escape a serialized object for postgresql you have to use the
pg_escape_bytea() native php method.

CI uses the pg_escape_string() native php method. seen in the postgre_driver.php file at line 294




Theme © iAndrew 2016 - Forum software by © MyBB