0

I try to scan the xls file (90Kb) for the ability to read (as it turned out that the file is corrupted) with code:

$reader = PHPExcel_IOFactory::createReader('Excel5');
if ($reader->canRead( $filename )) {

}

but I get:

Fatal error: String size overflow in /PHPExcel/Shared/OLERead.php on line 227

in function:

private function _readData($bl)
    {
    $block = $bl;
    $data = '';

    while ($block != -2)  {
        $pos = ($block + 1) * self::BIG_BLOCK_SIZE;
        $data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); // 227 LINE
        $block = self::_GetInt4d($this->bigBlockChain, $block*4);
    }
    return $data;
 }

Memory limit in php.ini is 4Gb

Do you have any ideas on how to avoid this fatal error?

Link to corrupted file

user451555
  • 308
  • 3
  • 12
  • Take a look at http://stackoverflow.com/questions/18545217/php-excel-memory-limit-of-2gb-exhausted-reading-a-286kb-file – John Svensson Oct 20 '15 at 22:32
  • Tanks! But my file downloaded from the browser and I can't change the download mode. The problem is that PHPExcel can't handle this problem, resulting is String size overflow. – user451555 Oct 20 '15 at 23:01
  • Yes! PHPExcel can handle the problem. It generates a fatal error telling you what the problem is. No! It can't handle the problem, it can't fix a corrupted file for you – Mark Baker Oct 21 '15 at 06:53
  • Sorry, Mark, I incorrectly expressed. It's bad that canRead function generates Fatal error instead false value. – user451555 Oct 21 '15 at 19:06

0 Answers0