ID: 11749 User Update by: [EMAIL PROTECTED] Old-Status: Feedback Status: Open Bug Type: Scripting Engine problem Operating system: Win32 (Win 2k) PHP Version: 4.0.6 Description: Unserialize dies with Apache Module but is FINE with CGI 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"); ?> Previous Comments: --------------------------------------------------------------------------- [2001-06-27 13:11:08] [EMAIL PROTECTED] Please include a short example of both script and the class you get this with. --------------------------------------------------------------------------- [2001-06-27 12:33:39] [EMAIL PROTECTED] 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 filesapache groupapachehtdocsgt2librariesclassesmodule.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. --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=11749 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]