Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Method DefaultValueBinder::bindValue not compatible with PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder::bindValue #4234

Closed
wants to merge 1 commit into from

Conversation

DioxideHydrogen
Copy link

Please take note of our contributing guidelines: https://docs.laravel-excel.com/3.1/getting-started/contributing.html
Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.

1️⃣ Why should it be added? What are the benefits of this change?

  • In PHP Version 8.2.18 the method bindValue from DefaultValueBinder must be exactly the PhpOffice\PhpSpreadsheet\Cell::bindValue
    image
    image
  • So i fixed it.

2️⃣ Does it contain multiple, unrelated changes? Please separate the PRs out.

  • No, its only one PR.

3️⃣ Does it include tests, if possible?

  • Already have it: ExcelTest::test_can_download_an_export_object_with_facade
  • Before:
    image
  • After:
    image

4️⃣ Any drawbacks? Possible breaking changes?

  • No, just added same param types, and return to DefaultValueBinder::bindValue method

5️⃣ Mark the following tasks as done:

  • Checked the codebase to ensure that your feature doesn't already exist.
  • Take note of the contributing guidelines.
  • Checked the pull requests to ensure that another person hasn't already submitted a fix.
  • Added tests to ensure against regression.

6️⃣ Thanks for contributing! 🙌

  • You're welcome :)

…ce\PhpSpreadsheet\Cell\DefaultValueBinder::bindValue
@patrickbrouwers
Copy link
Member

I'm not really sure why you are having that error. All tests are currently passing on all PHP versions (+ I haven't ran into it on either PHP8.2 as 8.3) -> https://github.com/SpartnerNL/Laravel-Excel/actions/runs/11760598680

After your change the tests fail on all PHP versions -> https://github.com/SpartnerNL/Laravel-Excel/actions/runs/11764992720

Is it possible you are running on a newer phpspreadsheet version than we currently support? Because as far as I know the supuported phpspreadsheet version does not have typehints on that class.

@abderraxim
Copy link

I confirm i've got the same issue

  Whoops\Exception\ErrorException 

  Declaration of Maatwebsite\Excel\DefaultValueBinder::bindValue(PhpOffice\PhpSpreadsheet\Cell\Cell $cell, $value) must be compatible with PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder::bindValue(PhpOffice\PhpSpreadsheet\Cell\Cell $cell, mixed $value): bool

  at vendor/maatwebsite/excel/src/DefaultValueBinder.php:15
     11▕      * @param  Cell  $cell  Cell to bind value to
     12▕      * @param  mixed  $value  Value to bind in cell
     13▕      * @return bool
     14▕      */
  ➜  15▕     public function bindValue(Cell $cell, $value)
     16▕     {
     17▕         if (is_array($value)) {
     18▕             $value = \json_encode($value);
     19▕         }

      +1 vendor frames 

  2   [internal]:0
      Whoops\Run::handleShutdown()

when phpspreadsheet got updated from 1.29.1 to 1.29.2

@patrickbrouwers
Copy link
Member

patrickbrouwers commented Nov 10, 2024

It seems something went wrong on PhpSpreadsheet side. 1.29.3 tag got put on the wrong branch so it contains all fixes from 3.5 You should lock phpspreadsheet to 1.29.2 till they resolve the tag issue

PHPOffice/PhpSpreadsheet#4227

@oleibman
Copy link

I have released PhpSpreadsheet 1.29.4, which I think is correct. Please confirm if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants