Commit Graph

2642 Commits

Author SHA1 Message Date
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
1d0e5eddd5 Add test case for bug #80483/#75035 2022-07-22 15:34:57 +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
Derick Rethans
8ea587a305 Import timelib 2022.01 2022-07-22 15:34:57 +01:00
Derick Rethans
b1575f996c Merge branch 'PHP-8.1' 2022-07-22 13:08:11 +01:00
Derick Rethans
7831a1cae6 Add test case for GH-8964 2022-07-22 13:06:32 +01:00
Derick Rethans
0d3061d225 Import timelib 2021.15 2022-07-22 13:06:32 +01:00
Derick Rethans
41694cfe13 Merge branch 'PHP-8.1' 2022-07-21 12:32:40 +01:00
Derick Rethans
557e02bf9f Merge timelib 2021.14 2022-07-21 12:11:42 +01:00
Derick Rethans
355995735b Fixed diff, again 2022-07-21 12:11:42 +01:00
Derick Rethans
37d460b64a Fixed #81263: Wrong result from DateTimeImmutable::diff 2022-07-21 12:11:42 +01:00
Derick Rethans
cc9c57722a Fixed GH-8730: DateTime::diff miscalculation is same time zone of different type 2022-07-21 12:11:42 +01:00
Derick Rethans
eea2283693 Merge timelib 2021.13 2022-07-21 11:42:35 +01:00
Máté Kocsis
e328c68305
Rename @cname to @cvalue in stubs (#9043)
@cname currently refers to the constant name in C. However, it is not always a (constant) name, but sometimes a function invocation, so naming it as @cvalue would be more appropriate.
2022-07-19 15:11:42 +02: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
Derick Rethans
9458f5f2c8 Merge branch 'PHP-8.1' 2022-06-17 09:36:52 +01:00
Derick Rethans
3fed226e62 Merge branch 'PHP-8.0' into PHP-8.1 2022-06-17 09:36:45 +01:00
Derick Rethans
b23dfe4986 Skip tests on 32-bit 2022-06-17 09:34:27 +01:00
Derick Rethans
36990aab8e Fixed bug #77243 (Weekdays are calculated incorrectly for negative years) 2022-06-17 09:34:27 +01:00
Pierrick Charron
6fd2b39397
Indent with TAB in .h files generated by gen_stub 2022-06-13 08:55:54 -04: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
Derick Rethans
242b9438ea Fixed tests that relied on date.timezone=UTC to work 2022-06-10 12:00:25 +01: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
Derick Rethans
e0d21297fe Update wording of warning message, and reinstate 'UTC' fallback for ctor 2022-06-02 09:24:13 +01:00
Derick Rethans
b3c6b540a1 Fixed bug #73239 (DateTime shows strange error message with invalid timezone) 2022-06-02 09:24:13 +01:00
George Peter Banyard
d08451b2ca
Replace php_stdint.h header with standard headers (#8613) 2022-05-29 11:20:56 +01:00
Máté Kocsis
21fe72757c
Declare DatePeriod properties (#8534) 2022-05-28 08:43:10 +02:00
Derick Rethans
33fd554a33 Fixed merge due to changed return type in API 2022-05-27 16:51:44 +01:00
Derick Rethans
1400aa4fb5 Merge branch 'PHP-8.1' 2022-05-27 14:44:41 +01:00
Derick Rethans
f3d23d45c0 Merge branch 'PHP-8.0' into PHP-8.1 2022-05-27 14:44:06 +01:00
Derick Rethans
d5e57268a9 Fixed bug #78139 (timezone_open accepts invalid timezone string argument). 2022-05-27 14:43:04 +01:00
Derick Rethans
e59bb88b7f Merge branch 'PHP-8.1' 2022-05-27 14:29:03 +01:00
Derick Rethans
4f32983fbe Merge branch 'PHP-8.0' into PHP-8.1 2022-05-27 14:27:29 +01:00
Derick Rethans
6418eba1cd Fixed bug #74671 (DST timezone abbreviation has incorrect offset) 2022-05-27 09:33:20 +01:00
Matteo Beccati
344555768a Merge branch 'PHP-8.1'
* PHP-8.1:
  Fixed test
2022-05-27 08:37:40 +02:00
Matteo Beccati
6d4ebe7e0f Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fixed test
2022-05-27 08:37:21 +02:00
Matteo Beccati
b90201745f Fixed test 2022-05-27 08:36:56 +02:00
Derick Rethans
f3441c832f Merge branch 'PHP-8.1' 2022-05-26 15:19:34 +01:00
Derick Rethans
a04eccb294 Merge branch 'PHP-8.0' into PHP-8.1 2022-05-26 15:19:27 +01:00
Derick Rethans
209ea3ffc7 Fixed tests 2022-05-26 14:30:22 +01:00
Derick Rethans
2dcd82162e Fixed bug #72963 (Null-byte injection in CreateFromFormat and related functions) 2022-05-26 13:49:51 +01:00
Derick Rethans
dfd1d7a531 Fixed bug #76963 (Null-byte injection in createFromFormat) 2022-05-26 13:49:51 +01:00
Máté Kocsis
14da1cb909
Add support for class constants in stubs (#7434) 2022-05-22 22:27:23 +02:00
George Peter Banyard
862ef7a332 Fix test expectation for date bug 81565 2022-05-20 14:29:46 +01:00
Derick Rethans
7fedb43f15 Merge branch 'PHP-8.1' 2022-05-20 13:25:43 +01:00
Derick Rethans
008016b536 Fixed bug #81565 (date parsing fails when provided with timezones including seconds) 2022-05-20 13:18:43 +01:00
Derick Rethans
78d5076b25 Fixed bug #51987 (Datetime fails to parse an ISO 8601 ordinal date (extended format)) 2022-05-20 13:18:43 +01:00
Derick Rethans
23dbefdb7b Fixed bug #51934 (strtotime plurals / incorrect time) 2022-05-20 13:18:43 +01:00
Derick Rethans
20d8c1bea5 Fixed bug #68549 (Timezones and offsets are not properly used when working with dates) 2022-05-20 13:18:43 +01:00
Derick Rethans
ee2776210b Fixed bug #66019 (DateTime object does not support short ISO 8601 time format - YYYY-MM-DDTHH) 2022-05-20 13:18:43 +01:00
Derick Rethans
ef55bf7149 Fixed bug GH-7758 (Problems with negative timestamps and fractions) 2022-05-20 13:18:42 +01:00
Derick Rethans
b510868bb8 Adjust existing tests for fixed bugs 2022-05-20 13:18:26 +01:00
Derick Rethans
546abc4bc6 Integrate timelib 2021.12 2022-05-20 13:18:26 +01:00
Derick Rethans
1af354a659 Add extra test case that hase both EXCLUDE_START_DATE and INCLUDE_END_DATE 2022-05-20 11:17:19 +01:00
Derick Rethans
4f1b8f4828 Add serialisation support for the new 'include_end_date' property 2022-05-20 11:17:19 +01:00
Derick Rethans
c0c801d238 Fixed bug #52015 (Allow including end date in DatePeriod iterations) 2022-05-20 11:17:19 +01:00
Máté Kocsis
8b991b4ae4
Add static return type for DateTime*::createFrom*() when possible
Fix GH-8544
2022-05-13 12:13:48 +02:00
Máté Kocsis
37b3092820
Fix more specific return type hints for some ext/date methods
Ideally, these methods should have been declared with a static return type, so let's add a PHPDoc type hint + a TODO for fixing the issue in the future.
2022-05-13 11:18:26 +02:00
Pavel Djundik
12702a2047 Add "N" and "o" format specifiers to idate() 2022-05-13 09:36:43 +01:00
Derick Rethans
1eab5b7970 GH-8458: DateInterval::createFromDateString does not throw non-relative items are present 2022-05-11 13:52:12 +01:00
Derick Rethans
5164f60c88 Merge branch 'PHP-8.1' 2022-05-05 15:24:14 +01:00
Derick Rethans
7670ee4342 Merge branch 'PHP-8.0' into PHP-8.1 2022-05-05 15:24:10 +01:00
Derick Rethans
92f8f19d50 Fixed GH-8471: Segmentation fault when converting immutable and mutable DateTime instances created using reflection 2022-05-05 12:10:50 +01:00
Derick Rethans
d54bcbb43b
Add DatePeriod's __serialize and __unserialize methods (#8464) 2022-05-03 22:06:17 +01:00
Derick Rethans
c1ad706b82 Fixed reference count issue with zend_string 2022-04-29 14:33:16 +01:00
Derick Rethans
ef30c9ed98 Update 32-bit only test 2022-04-29 14:19:27 +01:00
Derick Rethans
d57b05249c Extended tests 2022-04-29 10:27:40 +01:00
Derick Rethans
5fb36414a3 Fixed cloning DateInterval 2022-04-29 10:27:40 +01:00
Derick Rethans
cae1d4adde Add support for serialising all DateInterval objects 2022-04-29 10:27:40 +01:00
Derick Rethans
83a6bcc157 Fixed cloning DateInterval 2022-04-29 10:27:40 +01:00
Derick Rethans
c8a6a8abc0 Rename have_special_relative to from_string, fix serialisation constraint, and reorder fields 2022-04-29 10:27:40 +01:00
Derick Rethans
c280121b72 Add a few test cases for DateInterval 2022-04-29 10:27:40 +01:00
Derick Rethans
f4e5010aa9 Show the 'have_special_relative' property in var_dumps, and disallow serialization if set 2022-04-29 10:27:40 +01:00
Derick Rethans
76e852e7e8 Fixed memory leak with manual calls to DateInterval::__unserialize 2022-04-29 10:27:40 +01:00
Derick Rethans
f869a546e7 Add DateInterval's __serialize and __unserialize methods 2022-04-29 10:27:38 +01:00
Derick Rethans
3be8b5f5cb Remove fake properties from DateInterval 2022-04-29 10:26:50 +01:00
Derick Rethans
6f2c5017f9 Fixed memory leak with unserialize was called multiple times and an abbreviation was stored 2022-04-29 09:44:27 +01:00
Derick Rethans
181623f9c0 Add DateTimeZone's __serialize and __unserialize methods 2022-04-29 09:44:27 +01:00
Derick Rethans
8b2ee5388c Add DateTime/DateTimeImmutable's __serialize and __unserialize methods 2022-04-29 09:44:27 +01:00
Derick Rethans
36486106d9 Merge branch 'PHP-8.1' 2022-04-26 17:58:01 +01:00
Derick Rethans
97ffd75b13 Merge branch 'PHP-8.0' into PHP-8.1 2022-04-26 17:57:55 +01:00
Derick Rethans
b461c4673b Use the new RETURN_THROWS() instead of just returning NULL 2022-04-26 17:57:47 +01:00
Derick Rethans
a7eda3d548 Merge branch 'PHP-8.1' 2022-04-26 16:45:07 +01:00
Derick Rethans
bc43e69822 Merge branch 'PHP-8.0' into PHP-8.1 2022-04-26 16:45:01 +01:00
Derick Rethans
87f341b1c2 Return early when the timezone info is NULL.
The guess_timezone function does throw an error, but throwing an error doesn't
immediate make the PHP_FUNCTION return.

This check is really only necessary for distributions that patch PHP's timelib
to use system tzdata, but not correct enough to account for their
implementation to guarantee to return a timezone.
2022-04-26 16:43:30 +01:00
Marco Pivetta
25cb9cdb79
Fix GH-8232 - always reference classes in var_export() via their FQCN
Closes GH-8233

This fix corrects a behavior of `var_export()` that was mostly "hidden" until PHP 8.1 introduced:

* properties with object initializers
* constants containing object references
* default values of class properties containing `enum`s

Since `var_export(..., true)` is mostly used in conjunction with code generation,
and we cannot make assumptions about the generated code being placed in the root
namespace, we must always provide the FQCN of a class in exported code.

For example:

```php
<?php

namespace MyNamespace { class Foo {} }

namespace { echo "<?php\n\nnamespace Example;\n\n" . var_export(new \MyNamespace\Foo(), true) . ';'; }
```

produces:

```php
<?php

namespace Example;

MyNamespace\Foo::__set_state(array(
));
```

This code snippet is invalid, because `Example\MyNamespace\Foo::__set_state()` (which
does not exist) is called.

With this patch applied, the code looks like following (valid):

```php
<?php

namespace Example;

\MyNamespace\Foo::__set_state(array(
));
```

Ref: https://github.com/php/php-src/issues/8232
Ref: https://github.com/Ocramius/ProxyManager/issues/754
Ref: https://externals.io/message/117466
2022-04-23 11:06:21 +02:00
Derick Rethans
a690a56a86 Merge branch 'PHP-8.1' 2022-04-22 10:31:22 +01:00
Derick Rethans
15ee285f83 Merge branch 'PHP-8.0' into PHP-8.1 2022-04-22 10:31:14 +01:00
Derick Rethans
c854bb2472 Fixed GH-8400: bug73837.phpt makes no sense
Replaces the indeed silly test with something that actually does the job,
albeit much slower.
2022-04-22 10:29:37 +01:00
Derick Rethans
731e3f6c96 Merge branch 'PHP-8.1' 2022-04-14 10:32:25 +01:00
Derick Rethans
ec0771c03f Merge branch 'PHP-8.0' into PHP-8.1 2022-04-14 10:32:21 +01:00
Derick Rethans
e38d300a70 Refactor code to avoid duplication 2022-04-14 10:32:10 +01:00
Cody Mann
24085d0192 style/readability updates 2022-04-14 10:22:00 +01:00
Cody Mann
287c8a86b4 GH-7979: iterator advances when checking if valid 2022-04-14 10:22:00 +01:00
Derick Rethans
a4f4b96c91 Updated to version 2022.1 (2022a) 2022-04-07 10:45:21 +01:00
Derick Rethans
7e829d1536 Updated to version 2022.1 (2022a) 2022-04-07 10:45:20 +01:00
Derick Rethans
7aefee1613 Updated to version 2022.1 (2022a) 2022-04-07 10:45:19 +01:00
Derick Rethans
cd6c338c89 Merge branch 'PHP-8.1' 2022-04-01 13:28:13 +01:00
Derick Rethans
e6c4988187 Fixed #7752, #8101, #81660: DateTimeZone::getTransitions() returns insufficient data 2022-04-01 13:28:05 +01:00
Nikita Popov
902d64390e Deprecate implicit dynamic properties
Writing to a proprety that hasn't been declared is deprecated,
unless the class uses the #[AllowDynamicProperties] attribute or
defines __get()/__set().

RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
2021-11-26 14:10:11 +01:00
Derick Rethans
f893b55123 Merge branch 'PHP-8.1' 2021-11-18 13:56:07 +00:00
Derick Rethans
e4679ef0c2 Fixed date/diff where the difference in hour is less than 1 2021-11-18 13:55:51 +00:00
Derick Rethans
369ab3b53e Merge branch 'PHP-8.1' 2021-11-08 09:40:41 +00:00
Derick Rethans
904933e918 Fixed bug #81458: Regression: Incorrect difference after timezone change 2021-11-08 09:40:27 +00:00
Derick Rethans
64bd602b6a Updated to version 2021.5 (2021e) 2021-11-03 15:49:27 +00:00
Derick Rethans
456bfc7e9e Updated to version 2021.5 (2021e) 2021-11-03 15:49:27 +00:00
Derick Rethans
4ec9d07cc3 Updated to version 2021.5 (2021e) 2021-11-03 15:49:25 +00:00
Christoph M. Becker
b7d90f09d4
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix #81500: Interval serialization regression since 7.3.14 / 7.4.2
2021-10-15 19:14:00 +02:00
Christoph M. Becker
2e65c8e581
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81500: Interval serialization regression since 7.3.14 / 7.4.2
2021-10-15 19:13:38 +02:00
Christoph M. Becker
fc886694d3
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81500: Interval serialization regression since 7.3.14 / 7.4.2
2021-10-15 19:11:26 +02:00
Christoph M. Becker
866adb122a
Fix #81500: Interval serialization regression since 7.3.14 / 7.4.2
While it may not be desired, `DateInterval::$f` supports negative
values, at least with regard to calculations.  We still need to guard
from assigning double values which are out of range for signed 64bit
integers (which would be undefined behavior).  zend_dval_to_lval() does
this by returning `0` instead of triggering UB.  This way we can avoid
setting the invalid marker, which doesn't work as expected anyway.

We must not do that only for unserialization, but also when the property
is set in the first place.

We need to adapt some of the existing tests wrt. this behavior.  In
particular, we check for an arbitrary value in bug79015.phpt, to cater
to differences between 32bit and 64bit architectures.

Closes GH-7575.
2021-10-15 19:08:07 +02:00
Hao Sun
2feecaf3f5 Merge branch 'PHP-8.1'
* PHP-8.1:
  Reduce threshold further in ext/date/tests/bug73837.phpt
2021-10-12 00:56:48 +00:00
Hao Sun
582e21fbda Reduce threshold further in ext/date/tests/bug73837.phpt
The threshold in test case ext/date/tests/bug73837.phpt has been reduced
several times, from the original 990 to current 400. However, this case
still failed on my local test with Mac Mini machine(macOS on Apple
silicon). Here is the diff result:

```
  $ cat ext/date/tests/bug73837.diff
     int(%d)
  002+ microseconds do not differ enough (268)
  002- microseconds differ
```

Hence this patch reduces the threshold further.

Note that this patch should be backported to PHP 8.1 branch as well.

Closes GH-7567.
2021-10-12 00:49:21 +00:00
Derick Rethans
21e8af8296 Merge branch 'PHP-8.1' 2021-10-08 13:52:47 +01:00
Derick Rethans
7af0bf4d07 Merge branch 'PHP-8.0' into PHP-8.1 2021-10-08 13:52:34 +01:00
Derick Rethans
b230593b0e Merge branch 'PHP-7.4' into PHP-8.0 2021-10-08 13:52:18 +01:00
Derick Rethans
9733d49e14 Remove now superfluous tests due to changes in tzdata 2021-10-08 13:51:21 +01:00
Derick Rethans
c8764870ae Updated to version 2021.3 (2021c) 2021-10-08 12:54:55 +01:00
Derick Rethans
7ad877ced1 Updated to version 2021.3 (2021c) 2021-10-08 12:54:54 +01:00
Derick Rethans
c55b41d658 Updated to version 2021.3 (2021c) 2021-10-08 12:54:53 +01:00
Derick Rethans
8a61f1ece6 Updated to version 2021.3 (2021c) 2021-10-08 12:54:52 +01:00
Derick Rethans
8b55a84d00 Merge branch 'PHP-8.1' 2021-10-05 18:28:40 +01:00
Derick Rethans
6166ac51b7 Force UTC 2021-10-05 18:28:30 +01:00
Derick Rethans
0d6b8bbfcd Merge branch 'PHP-8.1' 2021-10-05 15:23:05 +01:00
Derick Rethans
68b874d10d Fixed bug #81504: Incorrect timezone transition details for POSIX data 2021-10-05 15:22:55 +01:00
Kamil Tekiela
c3dda473cc
Fix 'can not' in test data and in code comments 2021-10-05 09:51:58 +01:00
Christoph M. Becker
f6ac832f0a
[ci skip] Merge branch 'PHP-8.1'
* PHP-8.1:
  [ci skip] Remove erroneous XFAIL test
2021-10-01 18:59:54 +02:00
Christoph M. Becker
c468e37858
[ci skip] Remove erroneous XFAIL test
Bug #66257 is actually not a bug, but rather a documentation issue.

Closes GH-7543.
2021-10-01 18:59:01 +02:00
Kamil Tekiela
ca07cf3079
Merge branch 'PHP-8.1'
* PHP-8.1:
  getTimestamp does not return false
2021-09-30 09:16:25 +01:00
Kamil Tekiela
5fbba9b995
getTimestamp does not return false 2021-09-30 09:13:55 +01:00
George Peter Banyard
0663c64f41
Voidify php_date_interval_initialize_from_hash() 2021-09-29 17:15:50 +01:00
George Peter Banyard
492980c540
Use bool/zend_result instead of int in Date extension 2021-09-29 17:15:50 +01:00
Nikita Popov
9d8f97d58d Revert "Fix DATE_FORMAT_COOKIE definition"
This reverts commit ac34648cf6.

As pointed out on GH-6783, the new format doesn't match any of
the specified formats. Previously the constant generated

    Thursday, 14-Jul-2005 22:30:41 BST

which is obsolete. Now it generates

    Thu, 14-Jul-2005 22:30:41 BST

which is not specified at all. The correct version would be:

    Thu, 14 Jul 2005 22:30:41 BST

Reverting the change for now.
2021-09-29 09:26:40 +02:00
Mahmood Dhia
ac34648cf6 Fix DATE_FORMAT_COOKIE definition
In all of http://curl.haxx.se/rfc/cookie_spec.html,
https://docs.microsoft.com/de-de/windows/win32/wininet/http-cookies
and https://tools.ietf.org/html/rfc7234#section-5.3 the cookie
datetime is specified as Mon, DD-Mon-YYYY HH:MM:SS GMT. However,
the current definition returns Monday, DD-Mon-YYY HH:MM:SS GMT.
Therefore, the "l" in "l, d-M-Y H:i:s T" must be changed to "D".

Closes GH-6783.
2021-09-23 16:01:04 +02:00
Christoph M. Becker
fac3fbcb07
Fix OOB read due to timezone_open() with 5 digit offset
This has been reported as bug #78984, and is generally and properly
fixed as of timelib 2020.3 (PHP-8.0).  However, it is not fixed in
PHP-7.4, where the test results in an OOB read, and an unterminated
C string when calling `::getName()`.  Therefore, we apply a minimal
fix which just avoids this dangerous behavior.
2021-09-17 13:18:51 +02:00
Derick Rethans
b0dd55b11c Fixed test - the expected result was wrong 2021-08-31 17:19:28 +01:00
Derick Rethans
2bf451b925 Upgrade timelib to 2021.08, which address some defects and performance
- Fixed bug #80998 (Missing second with inverted interval).
- Speed up finding timezone offset information.
2021-08-31 15:29:48 +01:00
Dmitry Stogov
6871a49b66 Fix timelib_parse_zone() performance problem.
This makes "new DateTimeZone("Europe/London");" 170 times faster.

This is a hotfix for https://github.com/derickr/timelib/pull/99
2021-08-31 15:29:05 +03:00
Máté Kocsis
1bf1481a2a
Specify a few array func info entries (#7425) 2021-08-30 14:29:18 +02:00
Máté Kocsis
8e6e9838b0
Add support for generating MAY_BE_ARRAY_OF_REF func info flag (#7416) 2021-08-30 13:50:34 +02:00
Máté Kocsis
5e424d2884
Fix a few ext/date return types 2021-08-26 15:26:13 +02:00
Máté Kocsis
2d248c80b9
Generate optimizer func info from stubs for ext/date (#7403) 2021-08-25 21:29:46 +02:00
Derick Rethans
69fb3efe80 Fixed test by adding echo and expected string 2021-08-08 18:48:39 +01:00
Derick Rethans
d9c8e5a42e Fixed bug #80963: DateTimeZone::getTransitions() truncated 2021-08-08 17:27:21 +01:00
Derick Rethans
66ea59e38e Import timelib 2021.07
Fixes:
- Bug #80998 (Missing second with inverted interval). (Derick)
- Bug #81106 (Regression in 8.1: add() now truncate ->f). (Derick)
2021-08-08 17:22:06 +01:00
Derick Rethans
8426623521 Upgrade timelib to 2021.06
Fixes among others:
. Bug #79580 (date_create_from_format misses leap year).
. Bug #80974 (Wrong diff between 2 dates in different timezones).
. Bug #81097 (DateTimeZone silently falls back to UTC when providing an offset with seconds).
. Bug #81273 (Date interval calculation not correct).
2021-08-08 13:41:33 +01:00
Derick Rethans
4aeff60f34 Upgrade timelib to version 2020.03 2021-08-08 12:11:18 +01:00
Derick Rethans
84008782d3 Merge branch 'PHP-8.0' 2021-07-19 15:08:21 +01:00
Derick Rethans
9d0fb10823 Merge branch 'PHP-7.4' into PHP-8.0 2021-07-19 15:08:09 +01:00
Derick Rethans
26b1572d37 Move date timezone cache destruction to post deactivate
Some extensions try to use the date features in their own shutdown,
most notably some logging functions. Because of that, move the
cache tear down until after these resources have been cleaned up.
2021-07-19 15:07:01 +01:00
Nikita Popov
4b3615a33f Deprecate strftime() and gmstrftime()
These are deprecated in favor of date()/DateTime::format() (for
locale-indendent formatting) and IntlDateFormatter::format()
(for locale-dependent formatting).

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-14 09:38:43 +02:00
Nikita Popov
5bb83b3778 Deprecate date_sunrise() and date_sunset()
date_sunrise() and date_sunset() are deprecated in favor of
date_sun_info().

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:27:08 +02:00
Patrick Allaert
ac18dd0dc7 Prefer EXPECT over EXPECTF 2021-06-29 17:13:02 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Nikita Popov
6ce9076b2d Remove unnecessary skipifs in date 2021-06-14 15:35:48 +02:00
George Peter Banyard
b6958bb847
Implement "Deprecate implicit non-integer-compatible float to int conversions" RFC. (#6661)
RFC: https://wiki.php.net/rfc/implicit-float-int-deprecate

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-05-31 15:48:45 +01:00
Máté Kocsis
532c60cb92
Add support for tentative return types of internal methods
RFC: https://wiki.php.net/rfc/internal_method_return_types

Closses GH-6971
2021-05-14 15:55:25 +02:00
George Peter Banyard
2f1d0f2bc3
Throw directly instead of replacing error handler in ext/date (#6954) 2021-05-07 11:10:39 +01:00
Nikita Popov
3b3f6de782 Use zend_string_concat3 in one place
A bit nicer than snprintf + passing the same length around three
times.
2021-05-07 10:43:40 +02:00
George Peter Banyard
2cd5a200f5
Refactor php_date_initialize_from_hash()
Use early returns
Formalize return type to bool
2021-05-06 21:48:52 +01:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
George Peter Banyard
dcdc5d9069 Drop -Wno-implicit-fallthrough compiler flag
And add it back to ext/date, ext/hash, and ext/opcache
2021-04-19 13:59:18 +01:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
Derick Rethans
4e3d469c4a Skip test on 32bit, as the timestamp range is outside 32bit range 2021-04-06 23:54:51 +01:00
Derick Rethans
091c0920b9 Upgrade timelib to 2021.03 and fix many date/time issues 2021-04-06 20:50:32 +01:00
George Peter Banyard
6acb079906 Use zend_string_equals() API instead of strcmp() in Date extension 2021-03-17 16:36:16 +00:00
Nikita Popov
08ad9af2ca Reduce date test threshold further
Still seeing the occasional spurious failure.
2021-03-05 16:31:24 +01:00
Nikita Popov
670b19af3e Reduce threshold in ext/date/tests/bug73837.phpt
Now that this code is faster, we're seeing many spurious failures.
2021-03-04 17:02:02 +01:00
Dmitry Stogov
b4e9b18463 Avoid useless date conversion 2021-03-04 12:27:31 +03:00
Dmitry Stogov
72c3ededed Change the order of properties used for var_dump(), serialize(), comparison, etc.
Now properties are ordered according to their layout in zend_object structure.
2021-03-01 13:29:49 +03:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00
Nikita Popov
eb8ad30cf1 Fix quadratic slowdown under asan in timelib
This is a hotfix for https://github.com/derickr/timelib/pull/94
until the issue is resolved upstream.
2021-02-16 11:56:17 +01:00
Nikita Popov
b10416a652 Deprecate passing null to non-nullable arg of internal function
This deprecates passing null to non-nullable scale arguments of
internal functions, with the eventual goal of making the behavior
consistent with userland functions, where null is never accepted
for non-nullable arguments.

This change is expected to cause quite a lot of fallout. In most
cases, calling code should be adjusted to avoid passing null. In
some cases, PHP should be adjusted to make some function arguments
nullable. I have already fixed a number of functions before landing
this, but feel free to file a bug if you encounter a function that
doesn't accept null, but probably should. (The rule of thumb for
this to be applicable is that the function must have special behavior
for 0 or "", which is distinct from the natural behavior of the
parameter.)

RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

Closes GH-6475.
2021-02-11 21:46:13 +01:00
Máté Kocsis
99b08ac281
Implicitly enable function entry generation when class entry generation is enabled
Closes GH-6675
2021-02-09 13:37:24 +01:00
Máté Kocsis
5f21062054
Generate class entries for a few extensions
Relates to GH-6644
2021-02-03 09:24:09 +01:00
Derick Rethans
b67409e3d2 Updated to version 2021.1 (2021a) 2021-01-25 10:44:07 +00:00
Derick Rethans
fee80e397d Updated to version 2021.1 (2021a) 2021-01-25 10:44:06 +00:00
Derick Rethans
3f183bbcf8 Updated to version 2021.1 (2021a) 2021-01-25 10:44:05 +00:00
Nikita Popov
49e030d551 Merge branch 'PHP-8.0'
* PHP-8.0:
  Sync datefmt_get_calendar_object signature
  Sync intlcal_create_instance() and IntlCalendar::createInstance()
  Sync date_diff and DateTime::diff return type
2021-01-18 14:39:51 +01:00
Nikita Popov
c31f9f7ee4 Sync date_diff and DateTime::diff return type
This function/method cannot return false.
2021-01-18 14:39:32 +01:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Máté Kocsis
74e39ce06c
Merge branch 'PHP-8.0' 2020-12-28 14:46:00 +01:00
Máté Kocsis
46a2c6a8d7
Fix return type of DateTimeImmutable::__set_state() 2020-12-28 14:45:13 +01:00
Christoph M. Becker
bbae3dd7ff Merge branch 'PHP-8.0'
* PHP-8.0:
  DateTime*::getOffset() no longer returns false as of PHP 8.0.0
2020-12-26 15:13:56 +01:00
Christoph M. Becker
269936e680 DateTime*::getOffset() no longer returns false as of PHP 8.0.0
Cf. <https://github.com/php/doc-en/pull/282>.

Closes GH-6539.
2020-12-26 15:13:05 +01:00
Christoph M. Becker
4050589302 Merge branch 'PHP-8.0'
* PHP-8.0:
  Add regression test for bug #76770
2020-12-23 16:47:32 +01:00
Semen Dubina
959d3c9636 Add regression test for bug #76770
Closes GH-3514.
2020-12-23 16:47:08 +01:00
Derick Rethans
5a3c1f61d4 Merge branch 'PHP-8.0' into master 2020-12-21 10:32:17 +00:00
Derick Rethans
288332077f Fixed bug #80376 (last day of the month causes runway cpu usage) 2020-12-21 10:31:41 +00:00
Derick Rethans
b043759cb4 Fixed bug #80376 (last day of the month causes runway cpu usage) 2020-12-21 10:30:40 +00:00
Christoph M. Becker
32c6c29d79 Revert "DateTime:: and DateTimeImmutable::getTimestamp() may return false"
This reverts commit b67c232189.
2020-12-20 23:07:02 +01:00
Christoph M. Becker
b67c232189 DateTime:: and DateTimeImmutable::getTimestamp() may return false 2020-12-20 19:32:12 +01:00
Christoph M. Becker
3c68f43251 Fix ext/date stubs
Closes GH-6523.
2020-12-20 18:14:20 +01:00
Christoph M. Becker
b678df5dc8 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80280: ADD_EXTENSION_DEP() fails for ext/standard and ext/date
2020-10-26 11:06:10 +01:00
Christoph M. Becker
8b59e4e897 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80280: ADD_EXTENSION_DEP() fails for ext/standard and ext/date
2020-10-26 11:05:22 +01:00
Christoph M. Becker
2be27074b6 Fix #80280: ADD_EXTENSION_DEP() fails for ext/standard and ext/date
`ADD_EXTENSION_DEP()` relies on the `PHP_<extname>` config variables to
be set to `"yes"`, and since the standard and date extension are always
enabled, we define the respective variables uncoditionally.

Closes GH-6383.
2020-10-26 11:03:05 +01:00
Máté Kocsis
47bbfe1fc0
Require stubs to declare return types for magic methods when possible
Closes GH-6376
2020-10-23 16:33:16 +02:00
Derick Rethans
5eb6f593ee Updated to version 2020.4 (2020d) 2020-10-22 10:12:27 +01:00
Derick Rethans
4ea01bdc67 Updated to version 2020.4 (2020d) 2020-10-22 10:12:26 +01:00
Derick Rethans
d4200ba6cf Updated to version 2020.4 (2020d) 2020-10-22 10:12:24 +01:00
Derick Rethans
d0c2db4179 Updated to version 2020.3 (2020c) 2020-10-19 09:31:04 +01:00
Derick Rethans
a4c1a43a5b Updated to version 2020.3 (2020c) 2020-10-19 09:31:03 +01:00
Derick Rethans
7b5f232b03 Updated to version 2020.3 (2020c) 2020-10-19 09:31:02 +01:00
Máté Kocsis
d6264b0966
Verify parameter names of function aliases
Closes GH-6335
2020-10-16 10:56:33 +02:00
Máté Kocsis
186612e4d7
Improve parameter names in ext/intl
Closes GH-6309
2020-10-12 18:06:45 +02:00
Derick Rethans
63289cfff3 Merge branch 'PHP-7.4' into PHP-8.0 2020-10-11 14:54:12 +01:00
Derick Rethans
34179ba809 Merge branch 'PHP-7.3' into PHP-7.4 2020-10-11 14:54:02 +01:00
Derick Rethans
1ed5a2a54d Fixed test for bug #48097 due to confirmed data changes in timelib 2020-10-11 14:53:52 +01:00
Nikita Popov
cc58347105 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  XFAIL test broken by timelib update
2020-10-09 14:05:33 +02:00
Nikita Popov
229eb15f0e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  XFAIL test broken by timelib update
2020-10-09 14:05:23 +02:00
Nikita Popov
5018581410 XFAIL test broken by timelib update
I was expecting this to get fixed quickly, but it didn't.
XFAIL for now.
2020-10-09 14:04:47 +02:00
Derick Rethans
2180e882f3 Updated to version 2020.2 (2020b) 2020-10-08 15:19:48 +01:00
Derick Rethans
950157942e Updated to version 2020.2 (2020b) 2020-10-08 15:19:47 +01:00
Derick Rethans
14d231bd16 Updated to version 2020.2 (2020b) 2020-10-08 15:19:46 +01:00
Derick Rethans
088d284d9f Updated to version 2020.2 (2020b) 2020-10-08 15:05:40 +01:00
Derick Rethans
c8929dc17e Updated to version 2020.2 (2020b) 2020-10-08 15:05:39 +01:00
Derick Rethans
90a5d7c2ad Updated to version 2020.2 (2020b) 2020-10-08 15:05:38 +01:00
Nikita Popov
25f1c405ff Update ext/standard parameter names
Closes GH-6214.
2020-09-29 16:49:46 +02:00
Máté Kocsis
41b096b392
Promote a few forgotten warnings to exceptions
Closes GH-6211
2020-09-25 12:08:15 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
George Peter Banyard
95f4ee38bb Add some ValueErrors to ext/date
Closes GH-5613
2020-09-16 01:29:28 +02:00
Máté Kocsis
8e8a277b2f
Slightly improve error handling in DatePeriod::__construct() 2020-09-14 11:59:51 +02:00
Máté Kocsis
9975986b7e
Improve error messages mentioning parameters instead of arguments
Closes GH-5999
2020-09-09 10:47:43 +02:00
Derick Rethans
2ee2335249 Fixed bug #80057 (DateTimeImmutable::createFromFormat() does not populate time) 2020-09-04 15:55:08 +01:00
Nikita Popov
ecd986c879 Fix build warnings after timelib update 2020-08-31 14:28:39 +02:00
Derick Rethans
41e11a8e71 Merge branch 'PHP-7.3' into PHP-7.4 2020-08-31 12:31:44 +01:00
Derick Rethans
488e53c18b Fixed test case 2020-08-31 12:31:23 +01:00
Derick Rethans
8ec906563c Update timelib to 2020.02 2020-08-31 12:23:54 +01:00
Derick Rethans
0bc8785b61 Update timelib to 2020.01 2020-08-31 12:03:08 +01:00
Derick Rethans
4a84aca68f Merge branch 'PHP-7.4' into master 2020-08-31 11:42:20 +01:00
Derick Rethans
932b735822 Merge branch 'PHP-7.3' into PHP-7.4 2020-08-31 11:41:57 +01:00
Derick Rethans
778902db63 Update timelib to 2018.04 2020-08-31 11:41:41 +01:00
Nikita Popov
ac98ac7225 Merge branch 'PHP-7.4'
* PHP-7.4:
  Don't assert when comparing uninit DateTimeZone objects
2020-08-27 16:20:24 +02:00
Nikita Popov
5ae657b296 Don't assert when comparing uninit DateTimeZone objects
Nothing guarantees that the objects are initialized here... just
check as usual.
2020-08-27 16:18:45 +02:00
Nikita Popov
988fc94bbb Fix leak on failed DatePeriod initialization
We need to free not only p here, but also b and e.
2020-08-27 12:54:43 +02:00
Nikita Popov
e40c9d4918 Add some missing DatePeriod initialization checks 2020-08-13 17:23:23 +02:00
Nikita Popov
cdc4e49b84 Make strftime tests musl compatible
* Remove usage of strftime() in favor of date() in cases where
   we are not specifically testing strftime(). We implement
   date() ourselves, and as such are insulated from implementation-
   defined behavior.
 * Add skipif for broken strftime() %Z support. We have decided
   not to work around the issue for musl using manual expansion,
   as people should not be using this function anyway, and it is
   slated for future deprecation.
 * Don't test strftime() with invalid format specifier. The
   behavior is implementation-dependent.
2020-08-13 12:02:27 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Máté Kocsis
046cc5e4c2
Add another round of missing parameter types to stubs
Closes GH-5950
2020-08-07 16:48:45 +02:00
Nikita Popov
2965c8f868 Prefer strtoll over atoll
Both are specified by C99, but strtoll has specified overflow
behavior while atoll does not, so prefer using it.
2020-08-05 18:40:23 +02:00
Gregor Harlan
a6e3ce4fd6 datetime: new format "p", same as "P" but returning "Z" for UTC 2020-08-03 10:44:48 +02:00
Derick Rethans
90434d7fe3 Fixed bug #60302: DateTime::createFromFormat should new static(), not new self()
Also fixes similar issues for DateTimeImmutable::createFromFormat,
DateTime::createFromImmmutable, DateTime::createFromInterface,
DateTimeImmutable::createFromMutable, and
DateTimeImmutable::createFromInterface.
2020-08-03 00:43:41 +01:00