• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
trouble with OLE check in the read function

#1
In phpSpreadsheet I am trying to do a read(filename). One of the first things the code does is check the first 8 bytes of the xls (or xlsx) to see if it has the OLE signature. My code keeps failing there.

$this->data = file_get_contents($pFilename, false, null, 0, 8);
$identifierOle = pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1);
if ($this->data != $identifierOle) {
   throw new ReaderException('The filename ' . $pFilename . ' is not recognized as an OLE file');
}






The attached jpg shows this identifierOLE (packed into a string) on the second line, and the first 8 bytes of my xls file on the first line. 

I think that the file_get_contents() is working. But I can see that my first 8 bytes and identifierOle are NOT the same. I thought maybe it was the way I was looking at it. But I am out of ideas. This same piece of code seems to run whether it is a xls or a xlsx file. 


Attached Files Thumbnail(s)
   
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.