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:
$serializedObject = serialize($this);
$unSerializedObject = unserialize($serializedObject);
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:
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
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:
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
My question is why does the error pop up?
Here is the output of the serialize($this)
run against the text without the word journey
Here is the output of the serialize($this)
run against the text with the word journey
UPDATE
The table I'm saving object into has charset utf-8
and the column with no charset defined since it's of BLOB type.
The mb_detect_encoding(serialize($this))
returns UTF-8
There is no escaping for the $sql
. This is how the query is executed inside Kohana framework that I'm using:
$result = mysql_query($sql, $this->_connection)