Bug when saving sessions

Discussion about the open-source Phalanger [?] project.

Bug when saving sessions

Postby kripper » May 31st, 2012, 7:38 pm

This occurs with the latest SVN version:

Code: Select all
System.Runtime.Serialization.SerializationException: Type PHP.Core.PhpString is not marked as Serializable.
  at System.Runtime.Serialization.Formatters.Binary.BinaryCommon.CheckSerializable (System.Type type, ISurrogateSelector selector, StreamingContext context) [0x0002c] in /opt/imatronix/src/mono-2.10.9/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs:119
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.GetObjectData (System.Object obj, System.Runtime.Serialization.Formatters.Binary.TypeMetadata& metadata, System.Object& data) [0x0008e] in /opt/imatronix/src/mono-2.10.9/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs:406
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObject (System.IO.BinaryWriter writer, Int64 id, System.Object obj) [0x00000] in /opt/imatronix/src/mono-2.10.9/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs:316
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectInstance (System.IO.BinaryWriter writer, System.Object obj, Boolean isValueObject) [0x00062] in /opt/imatronix/src/mono-2.10.9/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs:303
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteQueuedObjects (System.IO.BinaryWriter writer) [0x00005] in /opt/imatronix/src/mono-2.10.9/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs:281
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectGraph (System.IO.BinaryWriter writer, System.Object obj, System.Runtime.Remoting.Messaging.Header[] headers) [0x0001f] in /opt/imatronix/src/mono-2.10.9/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs:268
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph, System.Runtime.Remoting.Messaging.Header[] headers) [0x0005f] in /opt/imatronix/src/mono-2.10.9/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:218
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph) [0x00000] in /opt/imatronix/src/mono-2.10.9/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:197
  at PHP.Core.AspNetSessionHandler.Persist (PHP.Core.PhpArray variables, PHP.Core.ScriptContext context, System.Web.HttpContext httpContext) [0x00000] in <filename unknown>:0
  at PHP.Core.RequestContext.EndSession (Boolean abandon) [0x00000] in <filename unknown>:0
  at PHP.Core.RequestContext.<TryDisposeBeforeFinalization>b__0 (System.Object _) [0x00000] in <filename unknown>:0
  at PHP.Core.ScriptContext.GuardedCall[Object,Object] (System.Converter`2 routine, System.Object data, Boolean allowUserExceptions) [0x00000] in <filename unknown>:0
kripper
 
Posts: 44
Joined: February 19th, 2012, 1:02 am

Re: Bug when saving sessions

Postby Jakub Misek » June 5th, 2012, 1:48 pm

PhpString was not marked as serializable. Will be fixed in upcoming release.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Bug when saving sessions

Postby kripper » June 5th, 2012, 7:41 pm

Ok. Thanks.

I'm providing a test case:

Code: Select all
   // Doesn't work
   $test = '';
   $test .= 'ok';
   $_SESSION['test'] = $test;


Code: Select all
   // Works
   $test2 = '';
   $test2 .= 'ok';
   $test2 = '' . $test2; // Probably this converts the PhpString (not serializable) to something else (serializable)
   $_SESSION['test2'] = $test2;


Note that the serialization problem only occurs when using the ASP.NET StateHandler.
kripper
 
Posts: 44
Joined: February 19th, 2012, 1:02 am


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 48 guests

cron

User Control Panel

Login

Who is online

In total there are 48 users online :: 0 registered, 0 hidden and 48 guests (based on users active over the past 5 minutes)
Most users ever online was 453 on April 27th, 2024, 1:05 am

Users browsing this forum: No registered users and 48 guests