Skip to content

Conversation

@saifulferoz
Copy link

This is:

  • [ *] a bugfix

Checklist:

  • [*] Changes are covered by unit tests
    • [*] Changes are covered by existing unit tests
    • New unit tests have been added
  • [ *] Code style is respected
  • Commit message explains why the change is made (see https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
  • CHANGELOG.md contains a short summary of the change and a link to the pull request if applicable
  • Documentation is updated as necessary

Why this change is needed?

This change is necessary because PHP_INT_MAX represents the maximum integer value supported by PHP on the current platform, which can be larger than what Excel or JavaScript can safely handle (specifically, numbers above 2^53 lose precision in JavaScript and Excel). By switching to self::EXCEL_MAX_INT (2^53), the code ensures that any integer value larger than what Excel can safely represent is treated as a string, preventing precision loss and data corruption when exporting to Excel. This makes the behavior consistent and safe across different platforms and environments.

Reference issue #4522

@oleibman
Copy link
Collaborator

I am not inclined to merge this. I see no reason why PhpSpreadsheet, which clearly has dependencies on Php and Excel, also needs a dependency on Javascript. However, I will have other suggestions to make in the linked issue.

@oleibman
Copy link
Collaborator

oleibman commented Jul 5, 2025

Superseded by PR #4527.

@oleibman oleibman closed this Jul 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants