PHPExcel – Trying to access array offset on value of type int

Hello everyone!
Recently, after updating the system to PHP 7.4, along with all that it implies, an interesting problem happened – the thing that was collecting reports started throwing errors at me in the form of Trying to access array offset on value of type int .
Oddly enough, the problem itself lies in the PHPExcel library, which for unknown reasons is not updated. The solution is quite easy – by editing the DefaultValueBinder.php file in the library itself. But a funny story – not everyone can just edit the library like this, for example, if it is pulled using composer.

Without thinking twice, I forked this library. I give you two solutions to the problem:

By replacing the package in composer.json

Open the composer.json file and first add the repository there. Also, if you suddenly need it, add ExcelBundle there.

    "repositories": [
        {
            "url": "https://github.com/ruecoder/ExcelBundle.git",
            "type": "git"
        },
        {
            "url": "https://github.com/ruecoder/PHPExcel.git",
            "type": "git"
        }
    ],

Then we drop the libraries themselves into the same composer.json in the require block

    "require": {
        "ruecoder/phpexcel": "dev-master",
        "ruecoder/excelbundle": "dev-master"
    }

And execute composer update

By editing the PHPExcel library

It’s simple. Follow the path and open the file vendor / PHPExcel / Classes / PHPExcel / Cell / DefaultValueBinder.php
We need line 82 which looks like this:

} elseif ($pValue[0] === '=' && strlen($pValue) > 1) {

replace it with this

} elseif (0 === strpos($pValue, '=') && strlen($pValue) > 1) {

Everything is ready, everything is working again as before. 🙂