[php-src] Issue #9847: Segmentation fault occurs when timezone database is corrupt
| From: | oatovar | Date: | Fri, 28 Oct 2022 21:50:00 +0000 |
| Subject: | [php-src] Issue #9847: Segmentation fault occurs when timezone database is corrupt | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242701@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9847
Author: oatovar
### Description
There has been a regression in PHP 8 and how it handles a corrupt timezone database. Previously, in
PHP 7.4, a fatal error was produced if the timezone database became corrupt. When using PHP 8.0, a
segfault occurs instead which makes it [harder to
debug](https://gitlab.com/gitlab-org/gitlab/-/issues/379253).
## Reproduction steps
1. Delete the timezone information:
sudo rm -rfv /usr/share/zoneinfo
1. Run the following code: `php -r 'echo date("Y");'
1. Observe that a segfault occurs instead of printing out an error message which is what occurred in
PHP 7.4.
Resulted in this output:
```
$ php -r 'echo date("Y");'
Segmentation fault
```
But I expected this output instead:
```
$ php -r 'echo date("Y");'
PHP Fatal error: date_default_timezone_get(): Timezone database is corrupt - this should *never*
happen
```
### PHP Version
PHP 8.0.13
### Operating System
_No response_