[php-src] Issue #13273: `idate()` doesn't work for year `-1`

From: Date: Mon, 29 Jan 2024 23:45:06 +0000
Subject: [php-src] Issue #13273: `idate()` doesn't work for year `-1`
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246362@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13273 Author: cs278 ### Description Using idate() where the expected answer is -1 results in a PHP warning and false being returned. The following code: ```php <?php var_dump(idate('Y', mktime(0, 0, 0, 1, 1, -1))); ``` Resulted in this output: ``` Warning: idate(): Unrecognized date format token in test.php on line 3 bool(false) ``` But I expected this output instead: ``` int(-1) ``` https://3v4l.org/A4Loi I'm pretty sure this code is responsible for the problem, as -1 is being used to signal an error: https://github.com/php/php-src/blob/34e2dc5697283dfa01c5f85cceafb99bb372ac7c/ext/date/php_date.c#L1033-L1037 ### PHP Version 8.2.15 ### Operating System Ubuntu 22.04

« previous php.bugs (#246362) next »