<?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/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: PHP Serialize() &amp; Unserialize()&#160;Issues</title> <atom:link href="http://davidwalsh.name/php-serialize-unserialize-issues/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/php-serialize-unserialize-issues</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Wed, 23 May 2012 19:56:08 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: Kasimir</title><link>http://davidwalsh.name/php-serialize-unserialize-issues#comment-32180</link> <dc:creator>Kasimir</dc:creator> <pubDate>Mon, 14 May 2012 13:21:11 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-32180</guid> <description>This not only solves problems serializing data with quotes and stuff, but also is a solution if you want to save an array with different kinds of data (text and binary, for instance) and don&#039;t want to worry about corruption somewhere along the way.Yes, the downside is your data increases in size when encoding, but serious amounts of data should not be stored in serialized format in a database anyway. For small amounts, it&#039;s really not a big issue and a great solution.</description> <content:encoded><![CDATA[<p>This not only solves problems serializing data with quotes and stuff, but also is a solution if you want to save an array with different kinds of data (text and binary, for instance) and don&#8217;t want to worry about corruption somewhere along the way.</p><p>Yes, the downside is your data increases in size when encoding, but serious amounts of data should not be stored in serialized format in a database anyway. For small amounts, it&#8217;s really not a big issue and a great solution.</p> ]]></content:encoded> </item> <item><title>By: Rashaad</title><link>http://davidwalsh.name/php-serialize-unserialize-issues#comment-31899</link> <dc:creator>Rashaad</dc:creator> <pubDate>Fri, 27 Apr 2012 06:05:10 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-31899</guid> <description>Saved my ass on that one!! Thanks a bunch!</description> <content:encoded><![CDATA[<p>Saved my ass on that one!! Thanks a bunch!</p> ]]></content:encoded> </item> <item><title>By: Kaustubh</title><link>http://davidwalsh.name/php-serialize-unserialize-issues#comment-31418</link> <dc:creator>Kaustubh</dc:creator> <pubDate>Mon, 02 Apr 2012 13:09:20 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-31418</guid> <description>Problem solved!Some data truncated by mysql due to large size of data.
Sorry!!!
It works!</description> <content:encoded><![CDATA[<p>Problem solved!</p><p>Some data truncated by mysql due to large size of data.<br
/> Sorry!!!<br
/> It works!</p> ]]></content:encoded> </item> <item><title>By: Kaustubh</title><link>http://davidwalsh.name/php-serialize-unserialize-issues#comment-31415</link> <dc:creator>Kaustubh</dc:creator> <pubDate>Mon, 02 Apr 2012 12:08:53 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-31415</guid> <description>hi,
I am using base64 encode and decode with serialize and unserialize. I came across following errorError: Notice: unserialize() [function.unserialize]: Error at offset 2 of 49151 bytesSome starting bytes before using base64_decode: czo1ODY4MzoiDQoJPHRhYAfter using base64 starting bytes are: s:58683:&quot;</description> <content:encoded><![CDATA[<p>hi,<br
/> I am using base64 encode and decode with serialize and unserialize. I came across following error</p><p>Error: Notice: unserialize() [function.unserialize]: Error at offset 2 of 49151 bytes</p><p>Some starting bytes before using base64_decode: czo1ODY4MzoiDQoJPHRhY</p><p>After using base64 starting bytes are: s:58683:&#8221;</p> ]]></content:encoded> </item> <item><title>By: John Vargo</title><link>http://davidwalsh.name/php-serialize-unserialize-issues#comment-31339</link> <dc:creator>John Vargo</dc:creator> <pubDate>Thu, 29 Mar 2012 19:30:40 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-31339</guid> <description>After 3/4 of a day of banging my head against my monitor, this post helped me solve my problem roundtripping a serialized object to a database. Thanks so much David.</description> <content:encoded><![CDATA[<p>After 3/4 of a day of banging my head against my monitor, this post helped me solve my problem roundtripping a serialized object to a database. Thanks so much David.</p> ]]></content:encoded> </item> <item><title>By: Douglas</title><link>http://davidwalsh.name/php-serialize-unserialize-issues#comment-31243</link> <dc:creator>Douglas</dc:creator> <pubDate>Mon, 26 Mar 2012 08:05:00 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-31243</guid> <description>This is a solution, yes, but base64-encoding the string makes it about 33% larger which isn&#039;t nice for large chunks of data. I&#039;d rather see a solution implemented strictly for the serialize() function, such as the one suggested by &#039;suman&#039; (http://www.php.net/manual/en/function.unserialize.php#107886):&lt;code&gt;
$auctionDetails = preg_replace(&#039;!s:(\d+):&quot;(.*?)&quot;;!se&#039;, &quot;&#039;s:&#039;.strlen(&#039;$2&#039;).&#039;:\&quot;$2\&quot;;&#039;&quot;, $dataArr[$i][&#039;auction_details&#039;] );
$auctionDetails = unserialize($auctionDetails);
&lt;/code&gt;</description> <content:encoded><![CDATA[<p>This is a solution, yes, but base64-encoding the string makes it about 33% larger which isn&#8217;t nice for large chunks of data. I&#8217;d rather see a solution implemented strictly for the serialize() function, such as the one suggested by &#8216;suman&#8217; (<a
href="http://www.php.net/manual/en/function.unserialize.php#107886" rel="nofollow">http://www.php.net/manual/en/function.unserialize.php#107886</a>):</p><p><code><br
/> $auctionDetails = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $dataArr[$i]['auction_details'] );<br
/> $auctionDetails = unserialize($auctionDetails);<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: Jonathan</title><link>http://davidwalsh.name/php-serialize-unserialize-issues#comment-31168</link> <dc:creator>Jonathan</dc:creator> <pubDate>Wed, 21 Mar 2012 15:37:02 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-31168</guid> <description>Thanks so much. You saved me! Stackoverflow had nothing.</description> <content:encoded><![CDATA[<p>Thanks so much. You saved me! Stackoverflow had nothing.</p> ]]></content:encoded> </item> <item><title>By: mina</title><link>http://davidwalsh.name/php-serialize-unserialize-issues#comment-31166</link> <dc:creator>mina</dc:creator> <pubDate>Wed, 21 Mar 2012 14:52:10 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-31166</guid> <description>After two hours of unsuccessful efforts, I found your post and been saved!
thanks!</description> <content:encoded><![CDATA[<p>After two hours of unsuccessful efforts, I found your post and been saved!<br
/> thanks!</p> ]]></content:encoded> </item> <item><title>By: Nick Woodhead</title><link>http://davidwalsh.name/php-serialize-unserialize-issues#comment-30891</link> <dc:creator>Nick Woodhead</dc:creator> <pubDate>Thu, 08 Mar 2012 12:58:12 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-30891</guid> <description>Thank you for you help!Although your solution wasn&#039;t quite enough to get it to work for me it was definitely part of the solution. I was trying to store the serialized string to my sql server db in a text field. After I realized that the &quot; were causing problems with unserialize and used the base64_encode I then realized that the string was being truncated when retrieving it from the db. The easiest way I found to get around this was to make these 2 changes in php.inimssql.textlimit = 2147483647
mssql.textsize = 2147483647They were set by default to 4096 and were commented out so remember to remove the ; too.Hope this helps someone.</description> <content:encoded><![CDATA[<p>Thank you for you help!</p><p>Although your solution wasn&#8217;t quite enough to get it to work for me it was definitely part of the solution. I was trying to store the serialized string to my sql server db in a text field. After I realized that the &#8221; were causing problems with unserialize and used the base64_encode I then realized that the string was being truncated when retrieving it from the db. The easiest way I found to get around this was to make these 2 changes in php.ini</p><p>mssql.textlimit = 2147483647<br
/> mssql.textsize = 2147483647</p><p>They were set by default to 4096 and were commented out so remember to remove the ; too.</p><p>Hope this helps someone.</p> ]]></content:encoded> </item> <item><title>By: Candace Camarillo</title><link>http://davidwalsh.name/php-serialize-unserialize-issues#comment-30869</link> <dc:creator>Candace Camarillo</dc:creator> <pubDate>Thu, 08 Mar 2012 04:28:33 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-30869</guid> <description>I am having a very similar issue after deploying to a production server.  I tried your copy/paste technique and had the same results.Did you ever discover what was causing your unserialize issue after moving servers?</description> <content:encoded><![CDATA[<p>I am having a very similar issue after deploying to a production server.  I tried your copy/paste technique and had the same results.</p><p>Did you ever discover what was causing your unserialize issue after moving servers?</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 2/7 queries in 0.009 seconds using disk: basic
Object Caching 805/805 objects using disk: basic

Served from: davidwalsh.name @ 2012-05-23 16:47:38 -->
