fisharebest / webtrees

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

2.0 On this day and Upcoming events #2209

Closed HRN-webtrees closed 5 years ago

HRN-webtrees commented 5 years ago

Not sure if this is same as https://github.com/fisharebest/webtrees/issues/1250

Blocks On this day and Upcoming events are fine when presented as table. If presented as list, I get following error:

Uncaught TypeError: intdiv() expects parameter 1 to be integer, float given in C:\xampp\htdocs\webtrees\app\I18N.php:764 Stack trace: #0 C:\xampp\htdocs\webtrees\app\I18N.php(764): intdiv(2270592000, 31536000) #1 C:\xampp\htdocs\webtrees\resources\views\modules\upcoming_events\list.phtml(14): Fisharebest\Webtrees\I18N::timeAgo(2270592000) #2 C:\xampp\htdocs\webtrees\app\View.php(144): include('C:\xampp\htdocs...') #3 C:\xampp\htdocs\webtrees\app\View.php(188): Fisharebest\Webtrees\View->render() #4 C:\xampp\htdocs\webtrees\app\Helpers\functions.php(108): Fisharebest\Webtrees\View::make('modules/upcomin...', Array) #5 C:\xampp\htdocs\webtrees\app\Module\UpcomingAnniversariesModule.php(157): view('modules/upcomin...', Array) #6 C:\xampp\htdocs\webtrees\app\Http\Controllers\HomePageController.php(320): Fisharebest\Webtrees\Module\UpcomingAnniversariesModule-

getBlock(Object(Fisharebest\Webtrees\Tree), 356, 'gedcom') #7 [internal function]: Fisharebest\Webtrees\Http\Controllers\HomePageController->treePageBlock in C:\xampp\htdocs\webtrees\app\I18N.php on line 764

fisharebest commented 5 years ago

Which version of webtrees is this?

HRN-webtrees commented 5 years ago

2.0 dev downloaded yesterday. php 7.2.12

fisharebest commented 5 years ago

Uncaught TypeError: intdiv() expects parameter 1 to be integer, float given

This value is computed by subtracting two integers, so I'm not sure how it can be a float.

Is there any other information you can give that might help me reproduce this?

HRN-webtrees commented 5 years ago

Just downloaded latest dev, and tested again. Added both blocks to index page, and they both work fine initally. When changing Presentation style from table to list I get the same error for the Upcoming events. On this day now works fine with both settings!

HRN-webtrees commented 5 years ago

I'm not able to reproduce this on demo site

fisharebest commented 5 years ago

Do you have any local modifications to your code?

HRN-webtrees commented 5 years ago

No modifications.

HRN-webtrees commented 5 years ago

On this day also throw the error message when "Show only events of living individuals" is set to "no" Works fine when set to "yes"

fisharebest commented 5 years ago

It sounds like you have one (or more) particular records that is triggering this.

Do you have any unusual dates. e.g. dates B.C., etc.

fisharebest commented 5 years ago

The error is in line 14 of resources\views\modules\upcoming_events\list.phtml, which is this

<?= ' (' . I18N::timeAgo($fact->anniv * 365 * 24 * 60 * 60) . ')'; ?>

Temporarily replace this line with

<?php var_dump($fact->anniv) ?>

Your upcoming event list should now contain lots of things like int(1234), and presumably one or more like float(1234.0).

Anything suspicious with the float ones?

HRN-webtrees commented 5 years ago

No unusual dates

Here is the list:

Nora Alvilde Adolfsen
Death — February 20, 1993 int(26) — Andenes, Andøy, Nordland, Norge Anne Andersdotter
Death — February 14, 1839 int(180) — Espenakken, Volda, Møre og Romsdal, Norge Kanutte Marte Andersdotter
Birth — February 17, 1826 int(193) — Eidset, Volda, Møre og Romsdal, Norge Mette Andersdotter
Death — before February 14, 1724 int(295) — Lianes, Ørsta, Møre og Romsdal, Norge Arne Andersen
Death — February 19, 1818 int(201) — Runde, Herøy, Møre og Romsdal, Norge Alvilde Helene Kristine Andreasdatter
Birth — February 17, 1887 int(132) — Lovika, Dverberg, Nordland, Norge Knut Aslakson
Birth — February 17, 1848 int(171) — Rød, Nesset, Møre og Romsdal, Norge Ole Aslakson
Birth — February 14, 1851 int(168) — Rød, Nesset, Møre og Romsdal, Norge Gjertrud Torbjørnsdotter Brænde
Birth — February 16, 1900 int(119) — Folkestad, Volda, Møre og Romsdal, Norge Esther Victoria Callsen
Death — February 20, 1967 int(52) — Aberdeen, Brown County, South Dakota, USA Johan Fredrik Klemetsen
Death — February 14, 1910 int(109) — Lovika, Dverberg, Nordland, Norge Kristoffer Colbanussen
Birth — February 15, 1800 int(219) — Viken, Frosta, Nord-Trøndelag, Norge Ruby Lanora Dawson
Death — February 16, 1986 int(33) — Riverside County, California, USA Enok Jentoft Edvardsen
Birth — February 19, 1859 int(160) — Steiro, Sortland, Nordland, Norge Karen Ellingsdotter
Birth — before February 15, 1756 int(263) — Ulvestad, Volda, Møre og Romsdal, Norge Gunnar Ellingson + Brite Olsdotter Marriage — February 20, 1718 int(301) — Volda, Møre og Romsdal, Norge Ole Elias Eriksen
Birth — February 17, 1881 int(138) — Rød, Aukra, Møre og Romsdal, Norge Jens Bech Gøttsche
Death — February 19, 1806 int(213) — Herefoss, Birkenes, Aust-Agder, Norge Jens Bech Gøttsche
Birth — before February 17, 1768 int(251) — Fredriksborg Amt, Danmark Aagot Holmsen
Death — February 14, 1953 int(66) — Stadsbygd, Sør-Trøndelag, Norge Cato Andreas Christian Holmsen
Birth — February 14, 1843 int(176) — Ørland, Sør-Trøndelag, Norge Fridthjof Hans Gøttsche Holmsen
Birth — February 18, 1861 int(158) — Kvarberg, Ringsaker, Hedmark, Norge Ole Andreas Ingebrigtson + Anna Karoline Olsdatter Marriage — February 17, 1914 int(105) — Bellingham, Whatcom County, Washington, USA Ane Margrethe Isaksdatter
Death — February 18, 1866 int(153) — Faksfjord, Dyrøy, Troms, Norge Isak Rasofiel Isaksen
Birth — February 15, 1881 int(138) — Igesund, Herøy, Møre og Romsdal, Norge Ingeborg Maria Jakobsdotter
Birth — February 18, 1816 int(203) — Bjørkedal Søre, Volda, Møre og Romsdal, Norge Kari Jakobsdotter
Death — before February 20, 1803 int(216) — Kornberg, Volda, Møre og Romsdal, Norge Oline Jakobsdotter
Birth — February 16, 1819 int(200) — Nautvika Ytre, Volda, Møre og Romsdal, Norge Ole Jakobsson
Birth — before February 20, 1763 int(256) — Mårstøyl, Volda, Møre og Romsdal, Norge Peder Andreas Johanneson
Death — February 17, 1975 int(44) — Volda, Møre og Romsdal, Norge Sæmund Martinus Andreas Johanneson Birth — February 18, 1868 int(151) — Nautøy, Herøy, Møre og Romsdal, Norge Jon Jonsson
Birth — before February 16, 1766 int(253) — Ulvestad, Volda, Møre og Romsdal, Norge Pernille Kanutte Karlsdotter
Death — February 18, 1916 int(103) — Dalslisjebøen, Volda, Møre og Romsdal, Norge Toralf Sigvart Klev
Birth — February 20, 1909 int(110) — Klev, Snåsa, Nord-Trøndelag, Norge Brite Knutsdotter
Death — before February 16, 1749 int(270) — Eidset, Volda, Møre og Romsdal, Norge Mette Knutsdotter
Death — before February 15, 1761 int(258) — Brekke, Ørsta, Møre og Romsdal, Norge Johan Andreas Knutson
Death — February 15, 1895 int(124) — Marburg, KwaZulu-Natal, Sør-Afrika Daniel Jakobus Knutsson
Birth — February 15, 1881 int(138) — Velle, Ørsta, Møre og Romsdal, Norge Ingeborg Larsdatter
Birth — February 16, 1817 int(202) — Jørstad, Snåsa, Nord-Trøndelag, Norge Peder Larsen
Birth — February 14, 1810 int(209) — Jørstad, Snåsa, Nord-Trøndelag, Norge Beret Anna Lassesdotter
Birth — February 20, 1841 int(178) — Hatlen, Bolsøy, Møre og Romsdal, Norge Nils Odin Lillebø
Birth — February 14, 1895 int(124) — Halkjelsvik, Volda, Møre og Romsdal, Norge Andrew Lind
Birth — February 18, 1901 int(118) — Port Shepstone, KwaZulu-Natal, Sør-Afrika Frida Lindeblad
Birth — February 17, 1882 int(137) — Skållerud, Mellerud, Dalsland, Västra Götaland, Sverige Torborg Lindeblad
Birth — February 19, 1876 int(143) — Tisselskog, Dalsland, Västra Götaland, Sverige Theodor Normann Lorentsen
Birth — February 20, 1885 int(134) — Berg, Kvæfjord, Troms, Norge Lisa Cajsa Löfberg
Death — February 14, 1886 int(133) — Oslo, Norge Asseline Moritsdotter
Birth — February 20, 1629 int(390) — Rygg, Gloppen, Sogn og Fjordane, Norge Ingeborg Moritsdotter
Birth — February 19, 1719 int(300) — Bjørkedal Søre, Volda, Møre og Romsdal, Norge Marta Nilsdatter
Death — before February 18, 1812 int(207) — Åse, Dverberg, Nordland, Norge Andreas Pauli Nilsen
Death — February 15, 1932 int(87) — Lovika, Dverberg, Nordland, Norge Anna Nilsen
Birth — February 17, 1907 int(112) — Volda, Møre og Romsdal, Norge Ingemann Arliot Nilsen
Birth — February 14, 1898 int(121) — Andenes, Dverberg, Nordland, Norge Iris Lynne Nilsen
Birth — February 15, 1932 int(87) — Hermosa Beach, Los Angeles, California, USA Marta Olsdotter
Death — before February 15, 1750 int(269) — Straume, Volda, Møre og Romsdal, Norge Gullik Olsson
Birth — February 20, 1718 int(301) — Høydalsdalen, Volda, Møre og Romsdal, Norge Jakob Olsson + Malene Knutsdotter Marriage — February 17, 1743 int(276) — Volda, Møre og Romsdal, Norge Jon Olsson
Birth — before February 16, 1800 int(219) — Bjørkedal Nøre, Volda, Møre og Romsdal, Norge Knut Olsson
Death — February 19, 1825 int(194) — Flovikholm, Veøy, Møre og Romsdal, Norge Ole Olsson
Death — before February 19, 1769 int(250) — Åmelfotdalen, Volda, Møre og Romsdal, Norge Ole Olsson
Birth — before February 15, 1773 int(246) — Sør Nesje, Veøy, Møre og Romsdal, Norge Lena Catharina Paludan
Death — February 17, 1806 int(213) — Oddernes, Kristiansand, Vest-Agder, Norge Bersvend Paulsen
Birth — before February 16, 1800 int(219) — Kaldalbakken, Beitstad, Nord-Trøndelag, Norge Cathinka Johanne Paus
Birth — February 17, 1874 int(145) — Oslo, Norge Johanne Caroline Paus
Birth — February 16, 1813 int(206) — Rising, Gjerpen, Skien, Telemark, Norge Anne Lisbet Pedersdotter
Birth — before February 19, 1764 int(255) — Kile, Volda, Møre og Romsdal, Norge Siri Pedersdotter
Birth — February 19, 1826 int(193) — Skinnvika, Volda, Møre og Romsdal, Norge Alfred Lawrence Prevost
Death — February 15, 1976 int(43) — Portland, Multnomah County, Oregon, USA Marit Rasmusdatter
Death — February 18, 1888 int(131) — Nerem, Vestnes, Møre og Romsdal, Norge Niels Rasmussen
Death — February 16, 1862 int(157) — Bø, Dverberg, Nordland, Norge Petra Rebbestad
Birth — February 19, 1907 int(112) — Ørstavik, Ørsta, Møre og Romsdal, Norge Per Olai Olsson Riste
Birth — February 20, 1846 int(173) — Riste, Sande, Møre og Romsdal, Norge Edward Joseph Roe
Birth — February 19, 1924 int(95) — Brooklyn, Kings County, New York, USA Jon Frederick Roe
Birth — February 18, 1937 int(82) — New York, USA Knut Pederson Rød
Birth — February 19, 1865 int(154) — Rød, Nesset, Møre og Romsdal, Norge Sigrid Pedersdotter Rød
Death — February 17, 1945 int(74) — Høvik, Nesset, Møre og Romsdal, Norge Jenny Marie Rødseth
Birth — February 18, 1902 int(117) — Volda, Møre og Romsdal, Norge Inger Else Røed
Birth — February 17, 1945 int(74) — Ørsta, Møre og Romsdal, Norge Antonette Birgithe Olufine Samuelsdatter Birth — February 16, 1877 int(142) — Aune indre, Trondenes, Troms, Norge Johanna Berntine Samuelsdatter
Birth — February 17, 1873 int(146) — Aune indre, Trondenes, Troms, Norge Earl Harold Sande + Marion Gascoyne Marriage — February 18, 1932 int(87) Sigvart Christian Sandness
Birth — February 18, 1901 int(118) — Barnes County, North Dakota, USA Floyd Hamilton Sayers
Death — February 14, 1939 int(80) — Yonkers, Westchester County, New York, USA Ola Sjurson
Death — February 17, 1867 int(152) — Leikongsætra, Herøy, Møre og Romsdal, Norge Clarence Ralph Snowberg
Death — February 17, 2003 int(16) — Minneapolis, Hennepin County, Minnesota, USA Barbro Solmundsdotter
Death — February 16, 1848 int(171) — Velle, Ørsta, Møre og Romsdal, Norge Ole Stenersen
Birth — before February 18, 1798 int(221) — Ovre, Gausdal, Oppland, Norge Luther O. Strommen
Birth — February 15, 1917 int(102) — North Dakota, USA Johannes Eriksson Söderström
Birth — February 17, 1823 int(196) — Sunnerud, Svanskog, Värmland, Sverige Erik Taraldsen
Death — February 20, 1866 int(153) — Gran, Snåsa, Nord-Trøndelag, Norge Robert Thomas
Birth — February 14, 1926 int(93) — Indianapolis, Marion County, Indiana, USA Ingrid Larsdatter Tvete
Death — February 18, 1992 int(27) — Vågen, Frosta, Nord-Trøndelag, Norge Jarle Larsen Tvete
Birth — February 17, 1915 int(104) — Vågen, Frosta, Nord-Trøndelag, Norge Lars Larsen Tvete
Death — February 15, 1969 int(50) — Frosta, Nord-Trøndelag, Norge Odd Tvete
Birth — February 20, 1916 int(103) — Aspgutu, Frosta, Nord-Trøndelag, Norge Anna Margrethe Marie Wangensteen
Death — February 14, 1879 int(140) — Asak, Halden, Østfold, Norge

magicsunday commented 5 years ago

The problem seems to be, that you are running a 32-Bit system, The largest available integer will be 2147483647. So 2270592000 will be converted to a float, as values outside of these ranges are represented by floating point values in PHP.

Maybe intdiv can't be used here, so the only solution seems to be changing the code to use floating point division and rounding or use some mathematical library to handle this stuff, like http://de2.php.net/manual/en/book.gmp.php.

HRN-webtrees commented 5 years ago

Thank you magicsunday! Tested on WAMP64 php 7.2.14, and can confirm the problem is gone.

fisharebest commented 5 years ago

I think there may be some other places that use seconds for time-differences. I'll need to rewrite these to avoid 32 bit overflow.