-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
On load excel - Document properties setCreated error #2331
Comments
The date and strtotime functions aren't Y2038-compliant for 32-bit PHP, which PhpSpreadsheet supports. Getting to your problem, the space between the hyphen and the 9 is indeed unexpected, and should be be a zero. How was your spreadsheet created? |
oleibman
added a commit
to oleibman/PhpSpreadsheet
that referenced
this issue
Oct 13, 2021
See issue PHPOffice#2331. Timestamp is expected in format yyyy-mm-dd (plus other information), with the expectation that month and day are 2 digits zero-filled on the left if needed. The user's file instead used a space rather than zero as filler. Although I don't know how the unexpected timestamp was created, it was easy enough to alter the timestamp in an otherwise normal spreadsheet, and use that file as a test case.
oleibman
added a commit
that referenced
this issue
Oct 24, 2021
See issue #2331. Timestamp is expected in format yyyy-mm-dd (plus other information), with the expectation that month and day are 2 digits zero-filled on the left if needed. The user's file instead used a space rather than zero as filler. Although I don't know how the unexpected timestamp was created, it was easy enough to alter the timestamp in an otherwise normal spreadsheet, and use that file as a test case.
Fixed in 1.19.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is:
What is the expected behavior?
e.g. $reader = IOFactory::createReaderForFile($some_file_path);
$spreadsheet = $reader->load($some_file_path);
should load excel file, but it fails because the date created is not in a correct format
What is the current behavior?
error: DateTime::__construct(): Failed to parse time string (2021- 9-13T13:24:38Z) at position 4 (-): Unexpected character
What are the steps to reproduce?
Error path : ROOT/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Properties.php
Error thrown - see the code with stars
// add code that show the issue here...
this can be fixed by adding the
$timestamp = date('Y-m-d h:i:s', strtotime($timestamp));
Which versions of PhpSpreadsheet and PHP are affected?
PhpSpreadsheet 1.18,
PHP 7.4.8
CakePHP 4.2.9
The text was updated successfully, but these errors were encountered: