prooph / event-store

PHP 7.4 EventStore Implementation
http://getprooph.org
BSD 3-Clause "New" or "Revised" License
548 stars 73 forks source link

DateTimeStringBugWorkaround fails in PHP 8 #414

Closed grymmare closed 3 years ago

grymmare commented 3 years ago

Since PHP 8, substr() returns an empty string where it previously returned false (see https://www.php.net/manual/en/function.substr.php)

Solution that works for both PHP 7 and PHP 8 would be to change line 26 in \Prooph\EventStore\Internal\DateTimeStringBugWorkaround::fixDateTimeString to

if (false === $micros || '' === $micros) {

A failing date would be 2020-12-14T12:55:57Z, which will be converted to 2020-12-14T12:55:57Z000000Z

enumag commented 3 years ago

PHP 8 is not yet supported (as specified in composer.json). There will most likely be more issues than just this one. Feel free to open a PR, adding PHP 8 to composer.json and travis + fixing this problem.