Php8-cli timezone database segfault at 34

I saw that this problem has already been mentioned twice, both with php7 and php8.
In both cases it was considered resolved by editing the php.ini.

I tried this too and it didn't work.
When executing the phpinfo() function, the timezone corresponds to the one defined in the php.ini (date.timezone = Europe/Berlin).
But when executing the date() function, the Segmentation fault error occurs.
I wrote a program to test in which situations the error occurs:

//	Only for debugging TZ error

function f_time($zone) {
	echo("Time now in ".(date_default_timezone_set($zone) ? (date_default_timezone_get().": ".date("d/m/Y-H:i:s")) : 'TZ error: '.$zone." is invalid").PHP_EOL);

The result of the execution with php-cli is:

Time now in CET: 21/02/2023-13:45:53
Time now in UTC: 21/02/2023-12:45:53
Time now in EST: 21/02/2023-07:45:53

Fatal error: Uncaught Error: Timezone database is corrupt. Please file a bug report as this should never happen in /overlay/reactphp/Foxbit6/timezoneError.php:11
Stack trace:
#0 /overlay/reactphp/Foxbit6/timezoneError.php(11): date_default_timezone_get()
#1 /overlay/reactphp/Foxbit6/timezoneError.php(6): f_time('Asia/Singapore')
#2 {main}
  thrown in /overlay/reactphp/Foxbit6/timezoneError.php on line 11

Comment: When commenting line with "Asia/Singapore", the same error occurs on line with "Europe/Berlin".

Another thing that caught my attention was that the result of the timezone_abbreviations_list() function does not contain many cities. But it contains for example "Asia/Singapore" which also gives the error. So this table returned by the timezone_abbreviations_list() function doesn't seem to be used.

This seems to be a Bug. Can anyone help me?

Best, and thanks in advance,

I think this is a Bug in compilation.

Same issue here.

echo ini_get('date.timezone');

Shows nothing! Meaning you cannot set it manually either. Probably the datetime class is missing or something.
Or probably the timezone database is missing ->

Edit: I think somebody has reduced the database by purpose for smaller size of php core

You can use EET, EST, UTC and similar

Normally the full timeline database is not installed by default into OpenWrt, and you need to manually install those zoneinfo packages that you need.

1 Like

I have installed zoneinfo-southamerica and upgraded all packages of OpenWrt 22.03.3 r20028-43d71ad93e, without solution.
All php 8.1.18-1 are installed and upgraded.

I found the trick.
I downloaded and unpacked it.
The timezone "America/Sao_Paulo" isn't included in zoneinfo-southamerica where are defined 4 zones, where Sao_Paulo belongs to "Brazil/East". I tested it on PHP8 as "Brazil/East" and it works.
Than I downloaded and found Sao_Paulo there.

I think the problem is resolved.

but in zoneinfo-northamerica.

Looking at the zone listing in , the Brazil zone is deprecated, offered for backward compatibility, and is actually a link to Sao_Paulo. See also

Looking at the downloadable zoneinfo OpenWrt package sizes, the northamerica is large, while southamerica is really small, almost empty. I wonder if our local Makefile is outdated and does not take into account the structural changes in the last decade, when IANA timezones have been simplified to some extent.

Yeah, the zoneinfo Makefile is structurally 9 years old, and apparently does not take into account the upstream structural changes since then.

1 Like

I made a PR to straighten the zoneinfo packages a bit (e.g. combine Americas),

but that PR does not touch php's internal database. See

1 Like