<?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>Thu, 09 Feb 2012 15:40:33 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>By: ZAGI</title><link>http://davidwalsh.name/php-serialize-unserialize-issues/comment-page-1#comment-28583</link> <dc:creator>ZAGI</dc:creator> <pubDate>Sat, 21 Jan 2012 06:40:46 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-28583</guid> <description>hi,  I had same problem, but I found that I had magic_quotes_runtime enabled which was causing the error.
hope this would be helpfull to.</description> <content:encoded><![CDATA[<p>hi,  I had same problem, but I found that I had magic_quotes_runtime enabled which was causing the error.<br
/> hope this would be helpfull to.</p> ]]></content:encoded> </item> <item><title>By: Chris Fav</title><link>http://davidwalsh.name/php-serialize-unserialize-issues/comment-page-1#comment-28504</link> <dc:creator>Chris Fav</dc:creator> <pubDate>Wed, 11 Jan 2012 02:30:25 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-28504</guid> <description>Thank you alot, FIXED my issue.</description> <content:encoded><![CDATA[<p>Thank you alot, FIXED my issue.</p> ]]></content:encoded> </item> <item><title>By: Bilal</title><link>http://davidwalsh.name/php-serialize-unserialize-issues/comment-page-1#comment-28211</link> <dc:creator>Bilal</dc:creator> <pubDate>Fri, 30 Dec 2011 01:22:59 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-28211</guid> <description>Thankyou!! that was really helpful :)</description> <content:encoded><![CDATA[<p>Thankyou!! that was really helpful :)</p> ]]></content:encoded> </item> <item><title>By: Charlie Schliesser</title><link>http://davidwalsh.name/php-serialize-unserialize-issues/comment-page-1#comment-27707</link> <dc:creator>Charlie Schliesser</dc:creator> <pubDate>Tue, 22 Nov 2011 19:31:23 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-27707</guid> <description>Might I throw in my 2 cents:json_encode() / json_decode().</description> <content:encoded><![CDATA[<p>Might I throw in my 2 cents:</p><p>json_encode() / json_decode().</p> ]]></content:encoded> </item> <item><title>By: Alix</title><link>http://davidwalsh.name/php-serialize-unserialize-issues/comment-page-1#comment-27428</link> <dc:creator>Alix</dc:creator> <pubDate>Thu, 03 Nov 2011 04:00:10 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-27428</guid> <description>I never leave comment, but you really save me man. Thanks</description> <content:encoded><![CDATA[<p>I never leave comment, but you really save me man. Thanks</p> ]]></content:encoded> </item> <item><title>By: vipul solanki</title><link>http://davidwalsh.name/php-serialize-unserialize-issues/comment-page-1#comment-27287</link> <dc:creator>vipul solanki</dc:creator> <pubDate>Tue, 18 Oct 2011 07:51:04 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-27287</guid> <description>please send me anyother solution if you find</description> <content:encoded><![CDATA[<p>please send me anyother solution if you find</p> ]]></content:encoded> </item> <item><title>By: vipul solanki</title><link>http://davidwalsh.name/php-serialize-unserialize-issues/comment-page-1#comment-27286</link> <dc:creator>vipul solanki</dc:creator> <pubDate>Tue, 18 Oct 2011 07:37:39 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-27286</guid> <description>i am having same problem as ypo havd earlier.
i tried out your code but its not working.</description> <content:encoded><![CDATA[<p>i am having same problem as ypo havd earlier.<br
/> i tried out your code but its not working.</p> ]]></content:encoded> </item> <item><title>By: nenillo</title><link>http://davidwalsh.name/php-serialize-unserialize-issues/comment-page-1#comment-27206</link> <dc:creator>nenillo</dc:creator> <pubDate>Mon, 10 Oct 2011 08:44:56 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-27206</guid> <description>I think this is caused by modern encoding (utf-8) and the use of old MySQL library (mysql_* functions on PHP).Changing MySQL API  to mysqli and setting the proper encoding (mysqli::set_charset) will fix this without base64.Base64 would use a lot of storage space.</description> <content:encoded><![CDATA[<p>I think this is caused by modern encoding (utf-8) and the use of old MySQL library (mysql_* functions on PHP).</p><p>Changing MySQL API  to mysqli and setting the proper encoding (mysqli::set_charset) will fix this without base64.</p><p>Base64 would use a lot of storage space.</p> ]]></content:encoded> </item> <item><title>By: NubbyNubkins</title><link>http://davidwalsh.name/php-serialize-unserialize-issues/comment-page-1#comment-27128</link> <dc:creator>NubbyNubkins</dc:creator> <pubDate>Wed, 05 Oct 2011 01:43:18 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-27128</guid> <description>Excellent solution. This is definitely a good way to go. I was thinking of using the preg_replace function to replace any single quotes, double quotes, semi_colons, or colons with a set of characters that is unlikely to be used in the string. For instance:$variable = preg_replace(&#039;&#124;\&#039;&#124;&#039;, &quot;_SINGLEQUOTE_&quot;, $variable);
$variable = preg_replace(&#039;&#124;\&#039;&#124;&#039;, &quot;_DOUBLEQUOTE_&quot;, $variable);
$variable = preg_replace(&#039;&#124;\&#039;&#124;&#039;, &quot;_SEMICOLON_&quot;, $variable);
$variable = preg_replace(&#039;&#124;\&#039;&#124;&#039;, &quot;_COLON_&quot;, $variable); $variable = serialize($variable);The downside to this solution is that it is a lot of work for a similar result and the unserialize function must utilize the same code but in reverse. I haven&#039;t yet tested the two but speed can definitely be a factor in which direction you would want to go. Also, with the preg_replace solution, you must use a string that will NOT be used in the variable at all or strange results will occur. Again, thanks for sharing your solution. I believe it may be a way that I will go with my code and its certainly a clever use of the base64_encode()/decode() functions.</description> <content:encoded><![CDATA[<p>Excellent solution. This is definitely a good way to go. I was thinking of using the preg_replace function to replace any single quotes, double quotes, semi_colons, or colons with a set of characters that is unlikely to be used in the string. For instance:</p><p>$variable = preg_replace(&#8216;|\&#8217;|', &#8220;_SINGLEQUOTE_&#8221;, $variable);<br
/> $variable = preg_replace(&#8216;|\&#8217;|', &#8220;_DOUBLEQUOTE_&#8221;, $variable);<br
/> $variable = preg_replace(&#8216;|\&#8217;|', &#8220;_SEMICOLON_&#8221;, $variable);<br
/> $variable = preg_replace(&#8216;|\&#8217;|', &#8220;_COLON_&#8221;, $variable); $variable = serialize($variable);</p><p>The downside to this solution is that it is a lot of work for a similar result and the unserialize function must utilize the same code but in reverse. I haven&#8217;t yet tested the two but speed can definitely be a factor in which direction you would want to go. Also, with the preg_replace solution, you must use a string that will NOT be used in the variable at all or strange results will occur. Again, thanks for sharing your solution. I believe it may be a way that I will go with my code and its certainly a clever use of the base64_encode()/decode() functions.</p> ]]></content:encoded> </item> <item><title>By: Dr Lightman</title><link>http://davidwalsh.name/php-serialize-unserialize-issues/comment-page-1#comment-26846</link> <dc:creator>Dr Lightman</dc:creator> <pubDate>Wed, 07 Sep 2011 15:21:09 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/php-serialize-unserialize-issues#comment-26846</guid> <description>I agree with Shimon in this, there is no reason why adding that layer of base64 encoding AFTER the serialization occurs, should resolve a problem with the unserialization, unless, and that&#039;s not been specified in here, the serialized data was messed up by some escaping function, encoding conversion, etc, before or after being stored in a database or similar.I understand that in that case, preventing the data from containing characters suscettible to escaping such as quotes, would be of help, but it&#039;s not a general case.</description> <content:encoded><![CDATA[<p>I agree with Shimon in this, there is no reason why adding that layer of base64 encoding AFTER the serialization occurs, should resolve a problem with the unserialization, unless, and that&#8217;s not been specified in here, the serialized data was messed up by some escaping function, encoding conversion, etc, before or after being stored in a database or similar.</p><p>I understand that in that case, preventing the data from containing characters suscettible to escaping such as quotes, would be of help, but it&#8217;s not a general case.</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 1/17 queries in 0.021 seconds using disk: basic
Object Caching 873/874 objects using disk: basic

Served from: davidwalsh.name @ 2012-02-09 10:57:50 -->
