Forum

Yampiz Forum

Sharing let knowledge Spreaded, Reading let spirits growth, Creative let culture extended, Let us
  • 禁止廣告文
  • 知識傳播
  • 閱讀
  • 心靈成長
  • 創作
  • 文化傳承
Forum Dictionary / Programming / 網頁/網站程式 / PHP /

unserialize() 偏移錯誤

New Subject
Random
Previous
Next
|
unserialize() 偏移錯誤

今天遇到一個很奇怪的題,訊息如下

Notice: unserialize(): Error at offset 76 of 82 bytes

發生的情況是在為一個文件檔serialize()之後存檔,接著再從檔案中讀取出來,在讀取時就發生了這個問題,而且是只發生在新檔案內容比舊檔內容多的時侯。

一開始以為是 flock 的問題,後來發現有沒有用 flock 都一樣,但是用 Ajax 第二次作讀取的動作就正常,也就是說,在同一支程序裡,寫完檔案後再將同一個檔案讀出來,在程序結束以前都會是原先檔案的內容長度,但是內容卻是新的檔案內容,所以才會出現明明定義有 50 個字,實際上字串只有 40 個字,所以在串列記錄裡的長度欄( 76 的位罝)就會報錯囉,而 82 是舊檔的長度!

推論是 PHP 本身的 Bug ,同一程序同檔案寫入讀出,檔案的長度資訊出了問題,但不確定,有請各方高手賜教,

  • Keywords : 問題, 同一, flock, 長度資訊出, 長度欄, 長度, 遇到一, 讀取, 訊息如下, 舊檔內容多, 舊檔, 第二, 程序裡, 發生, 為一, 檔案讀出來, 檔案後再, 檔案內容, 檔案, 本身
0 0
2009-10-23T18:59:37+0000

約小姐kk7417 :

!!! The contents has been hidden because it violates policy tactic. !!!
0 0
2022-03-21T14:19:32+0000


  • Now, you can post comments by Facebook Account when your Yampiz account was logout or unvariable. whatever, we suggest to post comment by Yampiz Account to get more bounds to join new events of Heyxu
Comment
 
Verify
  • Auto Platform
    For better browsing experience, it will auto detects your device to display webpage.
  • Bug Report
    Tell us about the idea, problem and errors you found.
  • Comodo Secure
    The sensitive data transmission adopts by SSL-2048 authenticated encryption.
  • Copyright
    © 2009 YamPiz Digital Inc. & Jaby Group. All rights reserved.
  • Revised Version
    V2.2.061
    03 Aug 2023 (GMT+8)