Commit graph

943 commits

Author SHA1 Message Date
Christoph M. Becker
f9453a889d
Fix GH-14732: date_sun_info() fails for non-finite values
`timelib_astro_rise_set_altitude()` is not prepared to deal with non-
finite values (`nan`, `inf` and `-inf`) for `lon` and `lat`; instead
these trigger undefined behavior.  Thus we catch non-finite values
before even calling that timelib function; for `date_sun_info()` we
trigger `ValueError`s; for `date_sunrise()` and `date_sunset()` we
silently return `false`, since these functions will be sunsetted
anyway.

Closes GH-16497.
2024-11-01 23:46:19 +01:00
Derick Rethans
b2b294a2b2
Fixed bug GH-16037 (Assertion failure in ext/date/php_date.c) 2024-10-18 12:37:03 +01:00
Christoph M. Becker
9bc34182b6
Fix GH-16454: Unhandled INF in date_sunset() with tiny $utcOffset
After normalization, `N` is supposed to be in range [0, 24], but for
very large and very small `$utcOffset` this is not necessarily the
case, since the normalization might yied `-inf` or `inf`.  If that
happens, we let the function fail silently, since it is highly unlikely
that such `$utcOffset`s are passed in practice.

Closes GH-16483.
2024-10-18 13:21:57 +02:00
Derick Rethans
fecad54d74
Backport fix from PHP 8.3: The exception handler already takes care of destroying the return value 2024-09-13 11:04:45 +01:00
Derick Rethans
f752e23cff
Fix GH-15582: Crash when not calling parent constructor of DateTimeZone 2024-09-11 16:37:40 +01:00
Máté Kocsis
6cab76986d
Add missing return for DatePeriod::__unserialize
Additionally, add other RETURN_THROWS() defensively.
2024-09-03 21:27:50 +02:00
Derick Rethans
b71d2e16e6 Fix GH-11416: Crash with DatePeriod when uninitialised objects are passed in (PHP 8.2+) 2023-08-09 16:10:14 +01:00
Derick Rethans
7f6e98cec7 Merge branch 'PHP-8.1' into PHP-8.2 2023-08-09 15:39:25 +01:00
Derick Rethans
4833b84854 Fix GH-11416: Crash with DatePeriod when uninitialised objects are passed in 2023-08-09 15:39:13 +01:00
Derick Rethans
1b5360587e Merge branch 'PHP-8.1' into PHP-8.2 2023-06-22 19:06:08 +01:00
Derick Rethans
0747616f84 Fixed GH-11368: Date modify returns invalid datetime 2023-06-22 17:58:19 +01:00
Niels Dossche
93becab506 Fix GH-11455: Segmentation fault with custom object date properties
Closes GH-11473.
2023-06-19 19:42:09 +02:00
nielsdos
caab608d57 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11281: DateTimeZone::getName() does not include seconds in offset
2023-05-23 18:56:40 +02:00
Niels Dossche
f9117eb824 Fix GH-11281: DateTimeZone::getName() does not include seconds in offset
If the seconds portion is non-zero, include the seconds in the output.

Closes GH-11282.
2023-05-23 18:52:07 +02:00
Derick Rethans
50ca489aa5 Merge branch 'PHP-8.1' into PHP-8.2 2023-03-23 14:49:18 +00:00
Derick Rethans
cbac68df6b Fix GH-10583: DateTime modify with tz pattern should not update linked timezone 2023-03-23 11:46:31 +00:00
Derick Rethans
ce5f75fb6f Fixed oss-fuzz #56931 2023-03-13 09:38:11 +00:00
Derick Rethans
a225581833 Fix GH-10747: Private and protected properties in serialized Date* objects throw 2023-03-10 14:39:22 +00:00
Derick Rethans
5d9ee8f920 Fixed OSS fuzz issues #55589, #55599, and #55727 2023-02-10 13:03:47 +00:00
Derick Rethans
cb907d50a8 Merge branch 'PHP-8.1' into PHP-8.2 2023-01-31 13:00:06 +00:00
Derick Rethans
a42bf93308 Fixed GH-10447: 'p' format specifier does not yield 'Z' for 00:00 2023-01-31 12:58:21 +00:00
Derick Rethans
85fbc6eaa6 Fix GH-10152: Custom properties of Date's child classes are not serialised 2023-01-31 12:53:03 +00:00
Derick Rethans
6b212b6dee Merge branch 'PHP-8.1' into PHP-8.2 2022-12-20 16:06:55 +00:00
Derick Rethans
d19a70c9a0 Fix GH-9891: DateTime modify with unixtimestamp (@) must work like setTimestamp 2022-12-20 14:41:13 +00:00
Derick Rethans
2e6b317fe3 Merge branch 'PHP-8.1' into PHP-8.2 2022-10-17 18:22:42 +01:00
Derick Rethans
25744dd73c Merge branch 'PHP-8.0' into PHP-8.1 2022-10-17 18:22:36 +01:00
Derick Rethans
7b48053293 Fixed GH-9763: DateTimeZone ctr mishandles input and adds null byte if the argument is an offset larger than 100*60 minutes 2022-10-17 17:08:44 +01:00
Derick Rethans
f8b27c73c9 Use 'const' for fixed API 2022-09-14 16:40:06 +01:00
Derick Rethans
dd365b044a Add 'const' to match actual API 2022-09-14 11:02:26 +01:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Derick Rethans
49c029858b Fixed error updating once more 2022-09-09 09:16:24 +01:00
Derick Rethans
f799bc4eca Don't return existing error_container/NULL, but use by-ref instead 2022-09-09 00:25:30 +01:00
Derick Rethans
8cdfffb753 Fixed MemorySanitizer: use-of-uninitialized-value warning introduced by 932586c426 2022-09-09 00:25:30 +01:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Derick Rethans
932586c426 Fixed bug GH-9431: DateTime::getLastErrors() not returning false when no errors/warnings
For PHP 8.2 and later only.
2022-08-29 14:33:41 +01:00
Derick Rethans
534127d3b2 Merge branch 'PHP-8.1' 2022-07-28 11:49:00 +01:00
Derick Rethans
b0d67aa605 Merge remote-tracking branch 'derickr/bug80047-take2' into PHP-8.1 2022-07-28 11:48:30 +01:00
Derick Rethans
001e7dbb04 Fixed bug #80047 (DatePeriod doesn't warn with custom DateTimeImmutable) 2022-07-28 10:28:10 +01:00
Derick Rethans
85f3a969dc Revert "Fixed #80047: DatePeriod doesn't warn with custom DateTimeImmutable"
This reverts commit 973c3f6e24.
2022-07-28 10:13:54 +01:00
Derick Rethans
6ae86c2358 Fixed bug #80022: Support ISO 8601 years outside 0000-9999 range better 2022-07-22 15:34:57 +01:00
Máté Kocsis
e13d60c039
DatePeriod properties cannot be made readonly (#9013) 2022-07-19 10:20:45 +02:00
Derick Rethans
0dbedb3dbd Fixed memory leaks with DatePeriod::__unserialise 2022-07-18 23:58:19 +01:00
Derick Rethans
30cc0c1742 Merge branch 'PHP-8.1' 2022-06-25 17:53:33 +01:00
Derick Rethans
49a3cc63dd Merge branch 'PHP-8.0' into PHP-8.1 2022-06-25 17:53:26 +01:00
Derick Rethans
973c3f6e24 Fixed #80047: DatePeriod doesn't warn with custom DateTimeImmutable 2022-06-25 17:52:14 +01:00
Ilija Tovilo
e79046fbe4
Fix redundant ZSTR_VAL condition in php_date.c (#8753)
ZSTR_VAL can never be NULL as zend_string.val is a char[1] which will
always decay to a non-nullable pointer.

This fails with -Werror on newer gcc versions.
2022-06-12 10:59:37 +02:00
Máté Kocsis
debd38f851 Add support for sensitive parameters in stubs 2022-06-04 18:15:05 +02:00
Derick Rethans
63aa5a4b5d Improve error message, and add additional test. 2022-06-02 09:24:13 +01:00
Derick Rethans
c85fcbc218 Remove no longer used 'timezone_valid' flag 2022-06-02 09:24:13 +01:00
Derick Rethans
6770158d47 Only warn when an incorrect timezone is set through 'date.timezone' 2022-06-02 09:24:13 +01:00