fisharebest / webtrees

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

Dates prior to 1901 fail on 32-bit systems ("On this day" feature - anniversaries-list.phtml) #5022

Open raaspt opened 2 weeks ago

raaspt commented 2 weeks ago

Hi, The "On this day" feature (anniversaries-list.phtml) breaks on 32-bit systems for dates prior to 1901 when "show only events of living individuals" is set to "no". I know there have been some comments on issues regarding this limitation, but I couldn't find anything regarding this specific feature.

In such cases, "$this->carbon->subYears($years)" in "app/Timestamp.php:183" returns "bool(false)" instead of "int(...)" causing the error:

Argument 1 passed to Fisharebest\Webtrees\Timestamp::__construct() must be of the type int, bool given, called in …/app/Timestamp.php on line 185 …/app/Timestamp.php:35

0 …/app/Timestamp.php(188): Fisharebest\Webtrees\Timestamp->__construct(false, 'Europe/Lisbon', 'pt_PT')

1 …/resources/views/lists/anniversaries-list.phtml(52): Fisharebest\Webtrees\Timestamp->subtractYears(130)

Any solution or workaround? Thanks.

magicsunday commented 2 weeks ago

PHP version?

I wouldn't have expected anyone to still use a 32-bit system. Especially in connection with genealogy research.

Perhaps you could integrate a check like in Drupal that issues a warning at the appropriate point. https://git.drupalcode.org/project/drupal/-/commit/9539eaf

raaspt commented 2 weeks ago

PHP 7.4.30 running on my old Synology NAS which I can't upgrade.

fisharebest commented 1 day ago

Elsewhere (e.g. the individual/family lists), we use ->subtractYears(100). Presumably you don't see an error here.

Your error message says ->subtractYears(130), which suggests that you have set "Age at which to assume dead" to 130.

Since 130 causes the overflow, and 100 does not, I wonder if using a lower number for this setting would be an effective work-around.