FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


unserialise ??? can somebody explain what's wrong to me





dinael
Notice: unserialize() [function.unserialize]: Error at offset 34 of 618 bytes in /home/dinael/domains/dinael.frih.net/public_html/yShout/php/filestorage.class.php on line 36

So basicly, I got this message when installing yShout [shoutbox] script.
I did ask the man who created it, and he said that this is probably because
PHP 5 is not installed on my hosting. But it is, i guess.

So if there is someone smart to tell me what's wrong I would appreciate it.
Rolling Eyes
ncwdavid
Could you please post from lines 30-40 in your code that would help.
dinael
sure:
Code:

}

   function load() {
      if (($contents = $this->read($this->path)) == null)
         return $this->resetArray();

      return unserialize($contents);
   }

   function save(&$array, $unlock = true) {
      $contents = serialize($array);
      $this->write($contents);
      if ($unlock) $this->unlock();
   }


this is from 30-43.
muggle
It looks like unserialize fails to process the input. You should verify the contents of the file and possibly how it has been created.
dinael
How can I verify such thing? I don't really know php and I was just following instructions,
which said - download and upload, and it will work. But it didn't work. OMG! what now? Shocked
muggle
I'm sorry; I don't know the application you've installed, so it will be hard to give you a valuable advice.
I guess the application is trying to read previously serialized data from a file and for some reason the data is not compatible with your system.
Maybe it's a good idea to start with verifying that you really have the version of PHP requested by the author of the software as you mentioned above.
Aredon
By studying the load function carefully, I've come to recognize:
Since unserialize is executing, $contents cannot be null lest the if-condition would have been true.
Since $contents isn't null it is a sign that the file exists and contains data. Since the error is with unserialize "Error at offset 34 of 618 bytes" it is able to read 618 bytes of the string from the file and it is finding a syntax error on the 34th byte.
Nextly $this->path is the file being read.
If you throw an echo $this->path; directly before the return unserialize($contents); I have a feeling it will echo when executed the following URL:
http://dinael.frih.net/yShout/logs/yshout.prefs.txt
Which I suspect to be a corrupted file for unserialize to read.
Try creating a file test.php
Code:

<?php
$d=file_get_contents("logs/yshout.prefs.txt");
echo nl2br(print_r(unserialize($d),TRUE));
?>

and give it an upload to your server to the following location http://dinael.frih.net/yShout/test.php
then run it from that location.

If that gives you an error, yshout.prefs.txt has a syntax error.

If not, try throwing an echo $contents; before the return unserialize($contents); so we know the string unserialize is stumbling on.
Related topics
visit counting *php*
Our Lord's Name Is Allah
Can anybody recommend a good anime?
What does Jesus say?
help on smf
How do i add MODS in php????
How To : Secure Your PHP Website
about RSS feeds
Typo installation
i want to use a 2 second internet browser
Any pagans in here?
Wordpress Doubt - -Urgent
Bermuda Triangle
Meta tags in phpbb3 please help
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.