fisharebest / webtrees

Online genealogy
https://webtrees.net
GNU General Public License v3.0
454 stars 298 forks source link

Search returns error "Epoch doesn't fit in a PHP integer" #4598

Open rookelaar opened 1 year ago

rookelaar commented 1 year ago

When I try to use search I get:

Epoch doesn't fit in a PHP integer …/app/Factories/TimestampFactory.php:71

0 …/app/Factories/TimestampFactory.php(71): DateTime->getTimestamp()

1 …/app/GedcomRecord.php(714): Fisharebest\Webtrees\Factories\TimestampFactory->fromString()

2 …/resources/views/lists/individuals-table.phtml(382): Fisharebest\Webtrees\GedcomRecord->lastChangeTimestamp()

3 …/app/View.php(183): include('...')

4 …/app/View.php(278): Fisharebest\Webtrees\View->render()

5 …/app/Helpers/functions.php(145): Fisharebest\Webtrees\View::make()

6 …/resources/views/search-results.phtml(104): view()

7 …/app/View.php(183): include('...')

8 …/app/View.php(278): Fisharebest\Webtrees\View->render()

9 …/app/Helpers/functions.php(145): Fisharebest\Webtrees\View::make()

10 …/resources/views/search-general-page.phtml(139): view()

11 …/app/View.php(183): include('...')

12 …/app/View.php(278): Fisharebest\Webtrees\View->render()

13 …/app/Helpers/functions.php(145): Fisharebest\Webtrees\View::make()

14 …/app/Http/ViewResponseTrait.php(50): view()

15 …/app/Http/RequestHandlers/SearchGeneralPage.php(219): Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralPage->viewResponse()

16 …/app/Http/Middleware/RequestHandler.php(54): Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralPage->handle()

17 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\RequestHandler->process()

18 …/app/Module/HitCountFooterModule.php(154): Middleland\Dispatcher->handle()

19 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Module\HitCountFooterModule->process()

20 …/app/Module/CheckForNewVersion.php(115): Middleland\Dispatcher->handle()

21 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Module\CheckForNewVersion->process()

22 …/app/Http/Middleware/CheckCsrf.php(80): Middleland\Dispatcher->handle()

23 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CheckCsrf->process()

24 …/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle()

25 …/app/Webtrees.php(275): Middleland\Dispatcher->dispatch()

26 …/app/Http/Middleware/Router.php(153): Fisharebest\Webtrees\Webtrees::dispatch()

27 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\Router->process()

28 …/app/Http/Middleware/BootModules.php(60): Middleland\Dispatcher->handle()

29 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BootModules->process()

30 …/app/Http/Middleware/RegisterGedcomTags.php(54): Middleland\Dispatcher->handle()

31 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\RegisterGedcomTags->process()

32 …/app/Http/Middleware/LoadRoutes.php(75): Middleland\Dispatcher->handle()

33 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\LoadRoutes->process()

34 …/app/Http/Middleware/CheckForNewVersion.php(65): Middleland\Dispatcher->handle()

35 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CheckForNewVersion->process()

36 …/app/Http/Middleware/UseTransaction.php(45): Middleland\Dispatcher->handle()

37 …/vendor/illuminate/database/Concerns/ManagesTransactions.php(29): Fisharebest\Webtrees\Http\Middleware\UseTransaction::Fisharebest\Webtrees\Http\Middleware{closure}()

38 …/app/Http/Middleware/UseTransaction.php(46): Illuminate\Database\Connection->transaction()

39 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseTransaction->process()

40 …/app/Http/Middleware/DoHousekeeping.php(73): Middleland\Dispatcher->handle()

41 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\DoHousekeeping->process()

42 …/app/Http/Middleware/UseTheme.php(69): Middleland\Dispatcher->handle()

43 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseTheme->process()

44 …/app/Http/Middleware/CheckForMaintenanceMode.php(51): Middleland\Dispatcher->handle()

45 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CheckForMaintenanceMode->process()

46 …/app/Http/Middleware/UseLanguage.php(71): Middleland\Dispatcher->handle()

47 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseLanguage->process()

48 …/app/Http/Middleware/UseSession.php(78): Middleland\Dispatcher->handle()

49 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseSession->process()

50 …/app/Http/Middleware/UpdateDatabaseSchema.php(57): Middleland\Dispatcher->handle()

51 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UpdateDatabaseSchema->process()

52 …/app/Http/Middleware/UseDatabase.php(118): Middleland\Dispatcher->handle()

53 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseDatabase->process()

54 …/app/Http/Middleware/BadBotBlocker.php(233): Middleland\Dispatcher->handle()

55 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BadBotBlocker->process()

56 …/app/Http/Middleware/CompressResponse.php(73): Middleland\Dispatcher->handle()

57 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CompressResponse->process()

58 …/app/Http/Middleware/ContentLength.php(40): Middleland\Dispatcher->handle()

59 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ContentLength->process()

60 …/vendor/middlewares/client-ip/src/ClientIp.php(65): Middleland\Dispatcher->handle()

61 …/app/Http/Middleware/ClientIp.php(47): Middlewares\ClientIp->process()

62 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ClientIp->process()

63 …/app/Http/Middleware/HandleExceptions.php(90): Middleland\Dispatcher->handle()

64 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\HandleExceptions->process()

65 …/app/Http/Middleware/BaseUrl.php(79): Middleland\Dispatcher->handle()

66 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BaseUrl->process()

67 …/app/Http/Middleware/ReadConfigIni.php(68): Middleland\Dispatcher->handle()

68 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ReadConfigIni->process()

69 …/app/Http/Middleware/SecurityHeaders.php(48): Middleland\Dispatcher->handle()

70 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\SecurityHeaders->process()

71 …/app/Http/Middleware/EmitResponse.php(57): Middleland\Dispatcher->handle()

72 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\EmitResponse->process()

73 …/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle()

74 …/app/Webtrees.php(275): Middleland\Dispatcher->dispatch()

75 …/app/Webtrees.php(262): Fisharebest\Webtrees\Webtrees::dispatch()

76 …/index.php(51): Fisharebest\Webtrees\Webtrees->httpRequest()

77 {main}

fisharebest commented 1 year ago

I guess you have a "last change timestamp" fact with an invalid date.

1) Can you run these two SQL queries on your database and tell me the output?

select * from wt_dates where d_fact = 'CHAN' order by d_year desc limit 1; select * from wt_dates where d_fact = 'CHAN' order by d_year asc limit 1;

2) Can you tell me if you are running a 32bit or 64bit version of PHP?

Create a PHP script containing the following, upload it to your server, and view it using your browser.

<?php echo PHP_INT_SIZE;

rookelaar commented 1 year ago
  1. MariaDB [webtrees]> select * from wt_dates where d_fact = 'CHAN' order by d_year desc limit 1; +-------+---------+-------+--------+--------------+--------------+--------+-------+--------+---------------+ | d_day | d_month | d_mon | d_year | d_julianday1 | d_julianday2 | d_fact | d_gid | d_file | d_type | +-------+---------+-------+--------+--------------+--------------+--------+-------+--------+---------------+ | 11 | NOV | 11 | 2022 | 2459895 | 2459895 | CHAN | X16 | 1 | @#DGREGORIAN@ | +-------+---------+-------+--------+--------------+--------------+--------+-------+--------+---------------+ 1 row in set (0.003 sec)

MariaDB [webtrees]> select * from wt_dates where d_fact = 'CHAN' order by d_year asc limit 1; +-------+---------+-------+--------+--------------+--------------+--------+-------+--------+---------------+ | d_day | d_month | d_mon | d_year | d_julianday1 | d_julianday2 | d_fact | d_gid | d_file | d_type | +-------+---------+-------+--------+--------------+--------------+--------+-------+--------+---------------+ | 0 | | 0 | 0 | 0 | 0 | CHAN | I7 | 1 | @#DGREGORIAN@ | +-------+---------+-------+--------+--------------+--------------+--------+-------+--------+---------------+ 1 row in set (0.003 sec)

  1. The system is 32bit, it's Raspbian OS script returns: 4
fisharebest commented 1 year ago

Can you look at record I7 (type I7 into the search box in the header), then use the edit-raw-gedcom option to see exactly what the 1 CHAN record looks like. It should be something like

1 CHAN
2 DATE xxxxx
3 TIME yyyyy
2 _WT_USER zzzzz
rookelaar commented 1 year ago

I believe you are referring to this:

1 CHAN 2 DATE (2021-01-26) 3 TIME 15:42:22

fisharebest commented 1 year ago

The date line should have the format 2 DATE 26 JAN 2021.

Can you tell me which software created this GEDCOM file? If you type HEAD into the search box, you should see the GEDCOM header record, which should have a "Source" field.

rookelaar commented 1 year ago

It was Ahnenblatt 3.43

rookelaar commented 1 year ago

I've checked my ged file and all fields CHAN have format like this: 2 DATE (2021-01-26)

fisharebest commented 1 year ago

Thanks for all the extra info.

The date format is invalid, so webtrees treats it as 0/0/0. 32 bit systems cannot handle dates prior to 01 JAN 1970.

Hence the error.

But not only is the data invalid - it is in a unconventional format. This is the first time I have ever seen yyyy-dd-mm.

Year-first dates are alwyas yyyy-mm-dd...

I'm not sure whether we should attempt to automatically "fix" this invalid data, or simply discard it.

Meanwhile, you can fix your system as follows.

Control panel -> Family tree -> Data fix -> Search and replace

Search for: \n2 DATE ((\d\d\d\d)-01-(\d\d)) Replace with \n2 DATE \2 JAN \1 Search type: Regular expression

Then repeat for 02 and FEB, 03 and MAR ... 12 and DEC

rookelaar commented 1 year ago

Thanks a lot! I rather treat it as a migration issue since I'm moving my family tree from other app. PS. Search should be: \n2 DATE \((\d\d\d\d)-12-(\d\d)\)

fisharebest commented 1 year ago

I rather treat it as a migration issue

Invalid data should never cause software to crash.

I just need to decide the best way to deal with this.

rookelaar commented 1 year ago

Yeah, it should return some user-friendly message that data is invalid instead of stacktrace, definitely.

arbor95 commented 1 year ago

you: "This is the first time I have ever seen yyyy-dd-mm." I don't see the above in this issue! I see yyyy-mm-dd . (26 is the day)

I just installed Ahnenblatt 3 (3.5 not 3.4): I see the usual format of changed date on export to gedcom. ... 1 CHAN 2 DATE 25 AUG 2022 3 TIME 9:45:18 2 _WT_USER Franz ...

fisharebest commented 1 year ago

I don't see the above in this issue! I see yyyy-mm-dd . (26 is the day)

Oops. My mistake.

reteP-riS commented 1 year ago

The error in the date format Greg referred to is this:

I believe you are referring to this:

1 CHAN 2 DATE (2021-01-26) 3 TIME 15:42:22

arbor95 commented 1 year ago

I do not think, that Ahnenblatt does produce this buggy date. My tests with Ahnenblatt did not produce something like that. We should have a view into the original gedcom.