Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fFile.php
r540 r551 Hide Line Numbers 10 10 * @link http://flourishlib.com/fFile 11 11 * 12 * @version 1.0.0b16 12 * @version 1.0.0b17 13 * @changes 1.0.0b17 Added ::__sleep() and ::__wakeup() for proper serialization with the filesystem map [wb, 2009-05-03] 13 14 * @changes 1.0.0b16 ::output() now accepts `TRUE` in the second parameter to use the current filename as the attachment filename [wb, 2009-03-23] 14 15 * @changes 1.0.0b15 Added support for mime type detection of MP3s based on the MPEG-2 (as opposed to MPEG-1) standard [wb, 2009-03-23] … … 535 536 536 537 /** 538 * The iterator information doesn't need to be serialized since a resource can't be 539 * 540 * @return array The instance variables to serialize 541 */ 542 public function __sleep() 543 { 544 if ($this->file_handle) { 545 fclose($this->file_handle); 546 $this->current_line = NULL; 547 $this->current_line_number = NULL; 548 $this->file_handle = NULL; 549 } 550 return array('exception', 'file'); 551 } 552 553 554 /** 537 555 * Returns the filename of the file 538 556 * … … 542 560 { 543 561 return $this->getFilename(); 562 } 563 564 565 /** 566 * Re-inserts the file back into the filesystem map when unserialized 567 * 568 * @return void 569 */ 570 public function __wakeup() 571 { 572 $file = $this->file; 573 $exception = $this->exception; 574 575 $this->file =& fFilesystem::hookFilenameMap($file); 576 $this->exception =& fFilesystem::hookExceptionMap($file); 577 578 if ($exception !== NULL) { 579 fFilesystem::updateExceptionMap($file, $exception); 580 } 544 581 } 545 582
