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

Unsupported operand types: string + string in date format (PHP 8.x) #4249

Open
7 tasks
alaindev opened this issue Nov 29, 2024 · 2 comments
Open
7 tasks

Unsupported operand types: string + string in date format (PHP 8.x) #4249

alaindev opened this issue Nov 29, 2024 · 2 comments

Comments

@alaindev
Copy link

This is:

- [X ] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

detect returned string when calling fromString then skip operation
(line 132) $value = DateTimeExcel\DateValue::fromString($value) + DateTimeExcel\TimeValue::fromString($value);

What is the current behavior?

string+string is an issue in PHP 8.x
Fatal error: Uncaught TypeError: Unsupported operand types: string + string in C:\Program Files\EasyPHP-Devserver-17\eds-www\aplitec\includes\modules\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Calculation\TextData\Format.php:132

What are the steps to reproduce?

save("crash.xlsx"); ?>

If this is an issue with reading a specific spreadsheet file, then it may be appropriate to provide a sample file that demonstrates the problem; but please keep it as small as possible, and sanitize any confidential information before uploading.

What features do you think are causing the issue

  • Reader
  • [ X] Writer
  • Styles
  • Data Validations
  • Formula Calculations
  • Charts
  • AutoFilter
  • Form Elements

Does an issue affect all spreadsheet file formats? If not, which formats are affected?

DATE Cell formatting when date cell is still a keyword and not yet a valid date!

Which versions of PhpSpreadsheet and PHP are affected? PHP >= 8.0

BUG_PHPSpreadsheet_PHP8_DATE.xlsx

@alaindev
Copy link
Author

test code is :

save("crash.xlsx"); ?>

@oleibman
Copy link
Collaborator

Sorry, I don't even understand what your spreadsheet contains. C2 seems to contain [onload.datecalcullong]. Is that what it is supposed to contain? B4 seems to contain ="Crash on au "&TEXT(C2,"jj/mm/aaaa"), which Excel evaluates as Crash on [onload.datecalcullong]. PhpSpreadsheet evaluates it as a #VALUE error (and it does not throw an exception when I load and save). Possibly this is locale-related - I'll need to do some research about that. But, while I'm doing that, it would be helpful to know how you expect this to behave.

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

No branches or pull requests

2 participants