I've just updated my phpexcel
to phpspreadsheet
, and I noticed this error pops up:
ErrorException (E_DEPRECATED) Array and string offset access syntax with curly braces is deprecated
require 'Classes/PHPExcel.php';
here is part of my code which is triggering the above error:
File: project/public/Classes/PHPExcel/Shared/ZipStreamWrapper.php
public function stream_open($path, $mode, $options, &$opened_path)
{
// Check for mode
if ($mode{0} != 'r') { //Error Line
throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
}
File: project/public/Classes/PHPExcel.php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); //Error Line
}
File: app/Http/Controllers/analyticsAuth/statement.old.php
use PHPExcel_Reader_Excel2007;
use PHPExcel;
use PHPExcel_IOFactory;
use ZipArchive;
require 'Classes/PHPExcel.php'; //Error Line
File: project/public/Classes/PHPExcel/Autoloader.php
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register(); //Error Line
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
Thank you
This can be fix by replacing the curly braces {}
with square brackets []
I would like to give credit to the @HeySora who made the comment and pointed out the exact issue in this particular case.
This is not longer in use $mode{0}
in php 7. it has been deprecated. Instead of using that use this $mode[0]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With