Jump to content

Error at offset 255 of 255 bytes

- - - - -

  • Please log in to reply
7 replies to this topic

#1
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
Hi guys

i have filed in database (array type) and serilized

when unserilize show error :

Notice: unserialize() [function.unserialize]: Error at offset 255 of 255 bytes in file.php on line 431


help me, i need unserilize all data

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
Can you verify what the serialized data is? You likely have stored it in a 255 length column.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
how to save max length array in mysql, and read ??

#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
You must make the column long enough to support the serialized text, i.e. VARCHAR(65535) or MEDIUMTEXT
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#5
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
my column is TEXT, this error for what?

#6
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
error fixed, error in record.

Thank you Alexander

how to verify serialize?

#7
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
You could run strlen on the serialized data before sending it to the database, and then running strlen again on the data after fetching it from the database. If the two lengths do not match then the data would be truncated and thus corrupt.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#8
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
A TEXT field also has a maximum length of 65535 characters if that is an issue.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users