title: unserialize() [function.unserialize]: Error at offset 49151 of 49151 bytes
body: <p>I have the offset error like many on the website after storing object into database and than retrieving it. If I don't store it everything works fine:</p>
  
  <pre><code>$serializedObject = serialize($this);
  $unSerializedObject = unserialize($serializedObject);
  </code></pre>
  
  <p>Besides, I use base64 encoding when saving data and retrieving it from database, but this doesn't help. I don't do any escaping though.
  My object processes some string. What I've found out is that with this string:</p>
  
  <pre><code>A woman is travelling around the world. She is 28 years old and she is from Great Britain.
  She cannot use a car or a plane on her
  </code></pre>
  
  <p>It works fine. But when I add one more space and word [ journey], the error pops up. Here is the string with this one word:</p>
  
  <pre><code>A woman is travelling around the world. She is 28 years old and she is from Great Britain.
  She cannot use a car or a plane on her journey
  </code></pre>
  
  <p>My question is why does the error pop up?</p>
  
  <p><a href="http://pastebin.com/vKm2rkLt" rel="nofollow">Here</a> is the output of the <code>serialize($this)</code> run against the text without the word <code>journey</code></p>
  
  <p><a href="http://pastebin.com/5NQzphTX" rel="nofollow">Here</a> is the output of the <code>serialize($this)</code> run against the text with the word <code>journey</code></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The table I'm saving object into has charset <code>utf-8</code> and the column with no charset defined since it's of BLOB type.
  The <code>mb_detect_encoding(serialize($this))</code> returns <code>UTF-8</code></p>
  
  <p>There is no escaping for the <code>$sql</code>. This is how the query is executed inside Kohana framework that I'm using:</p>
  
  <pre><code>$result = mysql_query($sql, $this-&gt;_connection)
  </code></pre>