[imp] Re: unserialize() failed in Tree.php / no identities

Akom lists@akom2.2y.net
Thu Nov 7 15:19:33 2002


Richard,

I've posted this originally and never got any replies or solutions.
I've done quite a bit of digging and discovered that Tree.php isn't the 
only place where this happens.  

Under some circumstances this happens in EVERY unserialize call in horde.  
What's interesting is that I can grab the string it's failing to 
unserialize and try the same thing in a separate php file or even in 
horde's php shell, and it will work fine!  (I'd put a print stmt before the 
call to tell me what the string is)...

I've gone through a year's worth of php, apache, mysql and horde revisions, 
all with basically the same symptoms.  A clean install of Mandrake didn't 
fix this.

I have a workaround which works MOST of the time:
Put a stripslashes() around the argument to EVERY unserialize call like so:

was: unserialise($some->sort($of_argument)) 
now: unserialise(stripslashes($some->sort($of_argument))) 

I did this to every unserialize call in horde (about 20-30 of them I guess) 
and it's been working fine.  Every so often (very rarely) the problem still 
happens, but it seems to be browser dependent (cookies or something, I 
think I saw something on another thread regarding Opera and deleting 
cookies)...

In some very stubborn cases where it becomes an issue (lately viewing 
attached images), I shut off error reporting before the offending line and 
turn it back on right after, like this:

$backup = error_reporting(0);
failing line of code with unserialize()
error_reporting($backup);

Now if someone has any idea why this would occur, I'd really like to know, 
cause this has bothered me for over a year now!

Akom



More information about the imp mailing list