<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP: unserialize() Error at offset&#8230; (simple solution)</title>
	<atom:link href="http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/feed/" rel="self" type="application/rss+xml" />
	<link>http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/</link>
	<description>things I learn, as I learn them</description>
	<lastBuildDate>Sat, 04 Feb 2012 01:35:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: A Free wordpress newsletter &#187; unserialize() Error at Offset… Different solutions</title>
		<link>http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/comment-page-1/#comment-16210</link>
		<dc:creator>A Free wordpress newsletter &#187; unserialize() Error at Offset… Different solutions</dc:creator>
		<pubDate>Thu, 15 Dec 2011 03:10:10 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=95#comment-16210</guid>
		<description>[...] others prefer to use [...]</description>
		<content:encoded><![CDATA[<p>[...] others prefer to use [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wp-coder.net &#187; unserialize() Error at Offset… Different solutions</title>
		<link>http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/comment-page-1/#comment-16209</link>
		<dc:creator>wp-coder.net &#187; unserialize() Error at Offset… Different solutions</dc:creator>
		<pubDate>Thu, 15 Dec 2011 03:06:52 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=95#comment-16209</guid>
		<description>[...] others prefer to use [...]</description>
		<content:encoded><![CDATA[<p>[...] others prefer to use [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: unserialize() Error at Offset… Different solutions &#124; WPhub.biz</title>
		<link>http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/comment-page-1/#comment-16204</link>
		<dc:creator>unserialize() Error at Offset… Different solutions &#124; WPhub.biz</dc:creator>
		<pubDate>Wed, 14 Dec 2011 19:19:58 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=95#comment-16204</guid>
		<description>[...] others prefer to use [...]</description>
		<content:encoded><![CDATA[<p>[...] others prefer to use [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Sommers</title>
		<link>http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/comment-page-1/#comment-14928</link>
		<dc:creator>Josh Sommers</dc:creator>
		<pubDate>Tue, 19 Jul 2011 03:24:52 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=95#comment-14928</guid>
		<description>I was getting the same error while using CodeIgniter.  Adding trim() before trying to unrealized worked beautifully.  Not sure if it matters, but I didn&#039;t get this until migrating from Ubuntu 8.04 to Ubuntu 10.04.

Thank you for the awesome time saving tip!

Aloha - Josh</description>
		<content:encoded><![CDATA[<p>I was getting the same error while using CodeIgniter.  Adding trim() before trying to unrealized worked beautifully.  Not sure if it matters, but I didn&#8217;t get this until migrating from Ubuntu 8.04 to Ubuntu 10.04.</p>
<p>Thank you for the awesome time saving tip!</p>
<p>Aloha &#8211; Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Damo</title>
		<link>http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/comment-page-1/#comment-11805</link>
		<dc:creator>Damo</dc:creator>
		<pubDate>Sun, 16 Jan 2011 02:29:09 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=95#comment-11805</guid>
		<description>It seems the problem is in fact something to do with CodeIgniter, I&#039;ve been using serialize()/unserialize() for a few years now and never had this problem until I recently started using CI. Thanks for the fix :)</description>
		<content:encoded><![CDATA[<p>It seems the problem is in fact something to do with CodeIgniter, I&#8217;ve been using serialize()/unserialize() for a few years now and never had this problem until I recently started using CI. Thanks for the fix <img src='http://ryanbosinger.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: frostymarvelous</title>
		<link>http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/comment-page-1/#comment-11307</link>
		<dc:creator>frostymarvelous</dc:creator>
		<pubDate>Sat, 11 Dec 2010 10:25:12 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=95#comment-11307</guid>
		<description>I figured out what was causing the error so I figured I&#039;d post it just in case.
You were right, there were some bytes after all. Seems the editor I was using threw in a few bytes at the beginning of the document when I saved as UTF-8. This is known as BOM (byte order marker). Luckily, it has an option to save UTF-8 without the BOM. That solved the issue.
Seems notepad does this also but doesn&#039;t have the option to save without BOM. The editor I used is notepad++. One of the best freeware I should add.
On a related issue, this also causes the session_start() headers cannot already sent error. That&#039;s how I actually figured it out.
Hope this helps.</description>
		<content:encoded><![CDATA[<p>I figured out what was causing the error so I figured I&#8217;d post it just in case.<br />
You were right, there were some bytes after all. Seems the editor I was using threw in a few bytes at the beginning of the document when I saved as UTF-8. This is known as BOM (byte order marker). Luckily, it has an option to save UTF-8 without the BOM. That solved the issue.<br />
Seems notepad does this also but doesn&#8217;t have the option to save without BOM. The editor I used is notepad++. One of the best freeware I should add.<br />
On a related issue, this also causes the session_start() headers cannot already sent error. That&#8217;s how I actually figured it out.<br />
Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: frostymarvelous</title>
		<link>http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/comment-page-1/#comment-11288</link>
		<dc:creator>frostymarvelous</dc:creator>
		<pubDate>Thu, 09 Dec 2010 18:28:48 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=95#comment-11288</guid>
		<description>Well, I was using curl to get the echoed data.
Worked fine till I changed all the encodings of all pages to UTF-8. I think I might have missed some, not sure.
But then I later tried and there it was, the same error.
I fixed it by echoing a base64 encoded string, and then decoding it after. Trim() didn&#039;t work for me however, so I thought I should post this for others.</description>
		<content:encoded><![CDATA[<p>Well, I was using curl to get the echoed data.<br />
Worked fine till I changed all the encodings of all pages to UTF-8. I think I might have missed some, not sure.<br />
But then I later tried and there it was, the same error.<br />
I fixed it by echoing a base64 encoded string, and then decoding it after. Trim() didn&#8217;t work for me however, so I thought I should post this for others.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Minh Tuan</title>
		<link>http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/comment-page-1/#comment-11250</link>
		<dc:creator>Minh Tuan</dc:creator>
		<pubDate>Mon, 06 Dec 2010 08:26:23 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=95#comment-11250</guid>
		<description>Sorry. my mean database field charset. 	utf8_general_ci for example</description>
		<content:encoded><![CDATA[<p>Sorry. my mean database field charset. 	utf8_general_ci for example</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Minh Tuan</title>
		<link>http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/comment-page-1/#comment-11249</link>
		<dc:creator>Minh Tuan</dc:creator>
		<pubDate>Mon, 06 Dec 2010 08:23:33 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=95#comment-11249</guid>
		<description>another case: check your database field encode</description>
		<content:encoded><![CDATA[<p>another case: check your database field encode</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Melli</title>
		<link>http://ryanbosinger.com/blog/2009/php-unserialize-error-at-offset-simple-solution/comment-page-1/#comment-9436</link>
		<dc:creator>Melli</dc:creator>
		<pubDate>Mon, 17 May 2010 09:06:30 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=95#comment-9436</guid>
		<description>I just want to say Thanks,
The trim() solution did not work in my case, but your advice put me on the path to what I believe is at the heart of this problem- database field lenght. As it turns out, serialize() will include a few control characters with the data. If the field lenght is too small, those control characters will be truncated with no error from the system that they were not included with your data. As it is, the bug dont show up until you are trying to retrieve the data with the &quot;unserialize()&quot; function. Of course, with some of the control characters missing, the retrieval fails. This  also explains, why trim() will work in some cases, depending on how much white space is can be removed with the trim(). For a permanent fix, increase the feild lenght in the database by a few characters to include the serialize control characters especially so if the data to be stored will vary in size.</description>
		<content:encoded><![CDATA[<p>I just want to say Thanks,<br />
The trim() solution did not work in my case, but your advice put me on the path to what I believe is at the heart of this problem- database field lenght. As it turns out, serialize() will include a few control characters with the data. If the field lenght is too small, those control characters will be truncated with no error from the system that they were not included with your data. As it is, the bug dont show up until you are trying to retrieve the data with the &#8220;unserialize()&#8221; function. Of course, with some of the control characters missing, the retrieval fails. This  also explains, why trim() will work in some cases, depending on how much white space is can be removed with the trim(). For a permanent fix, increase the feild lenght in the database by a few characters to include the serialize control characters especially so if the data to be stored will vary in size.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
