[Evocms-plugins-commits] SF.net SVN: evocms-plugins: [776] flickr_plugin/trunk/phpFlickr/phpFlickr.
Brought to you by:
blueyed
From: <bl...@us...> - 2008-07-11 23:02:52
|
Revision: 776 http://evocms-plugins.svn.sourceforge.net/evocms-plugins/?rev=776&view=rev Author: blueyed Date: 2008-07-11 16:02:51 -0700 (Fri, 11 Jul 2008) Log Message: ----------- Add mb_unserialize() and use it to unserialize the response. Fixes unserialize errors for utf8 data. Modified Paths: -------------- flickr_plugin/trunk/phpFlickr/phpFlickr.php Modified: flickr_plugin/trunk/phpFlickr/phpFlickr.php =================================================================== --- flickr_plugin/trunk/phpFlickr/phpFlickr.php 2008-07-11 23:01:16 UTC (rev 775) +++ flickr_plugin/trunk/phpFlickr/phpFlickr.php 2008-07-11 23:02:51 UTC (rev 776) @@ -25,6 +25,17 @@ } */ +/** + * Fix strlen in serialized string, then unserialize + * @link http://php.net/manual/en/function.unserialize.php#76012 + * @return mixed + */ +function mb_unserialize($serial_str) { + $out = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str ); + return unserialize($out); +} + + // Decides which include path delimiter to use. Windows should be using a semi-colon // and everything else should be using a colon. If this isn't working on your system, // comment out this if statement and manually set the correct value into $path_delimiter. @@ -278,7 +289,7 @@ * the result, so be sure that you look at the results. */ //$this->parsed_response = unserialize($this->response); - $this->parsed_response = $this->clean_text_nodes(unserialize($this->response)); + $this->parsed_response = $this->clean_text_nodes(mb_unserialize($this->response)); if ($this->parsed_response['stat'] == 'fail') { if ($this->die_on_error) die("The Flickr API returned the following error: #{$this->parsed_response['code']} - {$this->parsed_response['message']}"); else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |