Skip to content

Commit

Permalink
Ignore warning、notice
Browse files Browse the repository at this point in the history
  • Loading branch information
Janson committed Apr 4, 2018
1 parent 3e8fc34 commit c0b1b78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/Excel.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class Excel {
* @return \EC\PHPExcel\Reader\BaseReader
*/
public static function load($file, $callback = null, $encoding = null, $ext = '') {
set_error_handler(function($errno, $errstr, $errfile, $errline) {
// no-op
}, E_ALL ^ E_ERROR);

$ext = $ext ?: strtolower(pathinfo($file, PATHINFO_EXTENSION));

$format = self::getFormatByExtension($ext);
Expand Down
14 changes: 6 additions & 8 deletions src/Parser/Excel5.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
*/
namespace EC\PHPExcel\Parser;

error_reporting(E_ERROR);

use EC\PHPExcel\Exception\ParserException;
use EC\PHPExcel\Parser\Excel5\OLERead;
use EC\PHPExcel\Parser\Excel5\RC4;
Expand Down Expand Up @@ -985,14 +983,14 @@ private function readSst() {

// loop through the Unicode strings (16-bit length)
for ($i = 0; $i < $nm; ++$i) {
if (!isset($recordData[$pos + 2])) {
break;
}

// number of characters in the Unicode string
$numChars = Format::getUInt2d($recordData, $pos);
$pos += 2;

if (!isset($recordData[$pos])) {
break;
}

// option flags
$optionFlags = ord($recordData[$pos]);
++$pos;
Expand All @@ -1006,14 +1004,14 @@ private function readSst() {
// bit: 3; mask: 0x03; 0 = ordinary; 1 = Rich-Text
$formattingRuns = 0;
$hasRichText = (($optionFlags & 0x08) != 0);
if ($hasRichText) {
if ($hasRichText && isset($recordData[$pos])) {
// number of Rich-Text formatting runs
$formattingRuns = Format::getUInt2d($recordData, $pos);
$pos += 2;
}

$extendedRunLength = 0;
if ($hasAsian) {
if ($hasAsian && isset($recordData[$pos])) {
// size of Asian phonetic setting
$extendedRunLength = Format::getInt4d($recordData, $pos);
$pos += 4;
Expand Down

0 comments on commit c0b1b78

Please sign in to comment.