|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-06-27 12:33 UTC] btanner at home dot net
I've been running fine on CGI for a while now, jumping between 4.04, 4.07-dev, 4.05 When I tried to switch from 4.05 CGI to 4.05 4.05-Apache ... one of my files does not unserialize properly. The error message is: Warning: unserialize() failed at offset 487 of 2797 bytes in c:\program files\apache group\apache\htdocs\gt2\libraries\classes\module.class on line 189 If you guys know something about this, please let me know, as soon as possible. In the mean time, I am going to make a script that saves a serialized object to disk. I will save it to a file using CGI and then Apache modules. Then, I will try to load em both using Apache and CGI modules... see what turns up. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 10:00:02 2025 UTC |
Bingo.. got it down to a reasonable amount of code. I'll provide the code here (its still 65 lines). I have kept the "save" method, although it is not used in this example. Reason being is that I am loading an object that I previously saved, so its possible that the save method is the offender. Here you go. I'll also reply to this message in php-dev (if the list ever starts working) -- with the datafile attached. --Code starts-- <? class Module_Variable{ var $Type; var $Name; var $Value; function Module_Variable($Name,$Value,$Type="S"){ $this->Name=$Name; $this->Value=$Value; $this->Type=$Type; } } //end of module_variable class class Module { var $Variables; // Array of Configuration Variables for this Module var $Inclusions; // Array of Inclusions in case of newuser,deleteuser,etc,etc var $Path; // Path from Root to get to this module var $Name; var $Loaded; // Has this module been loaded, or not? function Module($Name,$Path){ $this->Name=$Name; $this->Path=$Path; $this->Loaded=0; $this->Variables=""; } function Save(){ $ModCode=serialize($this); $FileLocation=__DATAPATH."mod_data/".$this->Name.".mod"; $FilePointer=fopen($FileLocation,"w"); $WriteCheck=fwrite($FilePointer,$ModCode); if(!$WriteCheck) die("Error writing output..."); fclose($FilePointer); } function Load(){ $FileLocation=$this->Name.".mod"; $FilePointer=@fopen($FileLocation,"r"); if(!$FilePointer) $this->HandleError($FileLocation); $EncodedString=fread($FilePointer,filesize($FileLocation)); fclose($FilePointer); $VarObject=unserialize($EncodedString); $this->Variables=$VarObject->Variables; $this->Loaded=1; } }//end the class $MyModule=new Module("login",""); $MyModule->Load(); print("<hr><Br>Good so far"); ?>