1088 Commits
Author SHA1 Message Date
Weilin Du 3c6e28f46b Merge branch 'PHP-8.6'
* PHP-8.6:
  Fix GH-24350: Stale external tz database read after module restart (#24354)
2026-10-16 23:19:16 +08:00
Weilin Du 6cbd3dcff7 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Fix GH-24350: Stale external tz database read after module restart (#24354)
2026-10-16 23:18:53 +08:00
Weilin Du 1ef29ab4be Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-24350: Stale external tz database read after module restart (#24354)
2026-10-16 23:17:31 +08:00
lazerg 3f5189034f Fix GH-24350: Stale external tz database read after module restart (#24354)
Reset the external timezone database pointer and enabled flag before
registering the date INI entries. Registering date.timezone invokes its
update handler, which validates the timezone against DATE_TIMEZONEDB.

After an in-process engine shutdown, the external database may still point
into an unloaded timezonedb shared library. Resetting the state first avoids
reading unmapped memory during the next startup while allowing the external
database to be installed again when its extension starts.

Fixes GH-24350.

Closes #24354
2026-10-16 23:17:06 +08:00
Arnaud Le Blanc 8ba5aa7eea Merge branch 'PHP-8.6'
* PHP-8.6:
  [ci skip] NEWS
  Fix GH-20503: Assertion failure with ext/date DateInterval property hash (#20720)
2026-10-15 19:31:22 +02:00
Arnaud Le Blanc d4265ca89c Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  [ci skip] NEWS
  Fix GH-20503: Assertion failure with ext/date DateInterval property hash (#20720)
2026-10-15 19:31:12 +02:00
Arnaud Le Blanc 5828413f6f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  [ci skip] NEWS
  Fix GH-20503: Assertion failure with ext/date DateInterval property hash (#20720)
2026-10-15 19:30:47 +02:00
Heath Dutton🕴️ 7ffbf30cfc Fix GH-20503: Assertion failure with ext/date DateInterval property hash (#20720) 2026-10-15 19:28:35 +02:00
Kamil Tekiela 4ab0ffb5d1 Zend: Remove returns after zend_error_noreturn (#23285) 2026-10-01 17:53:54 +01:00
Dmytro Kulyk 67135cb97b gen_stub: Conditionally include zend_attributes.h to arginfo based on usage (#21570)
Headers required by the generated code (zend_attributes.h, zend_constants.h, zend_enum.h) are collected during generation and emitted as includes at the top of the arginfo file, with the same preprocessor conditions and PHP version guards as the code that needs them.

Removes the manual zend_attributes.h and zend_enum.h includes from sources that only needed them for the arginfo file they include.
2026-09-06 21:25:20 +02:00
Gina Peter Banyard 48190ac8ed ext/date: Throw exceptions directly (#19166) 2026-09-01 17:10:31 +01:00
Tim DüsterhusandTim Düsterhus 1cf46237a5 Time\Duration (#23073)
* date: Add `Time\Duration`

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

* date: Cache the most recently `Time\Duration` object created with `from*()`

This is useful for patterns like the following:

    for (;;) {
        $watchers = $poll->wait(Time\Duration::fromSeconds(1));
        // …
    }

which is repeatedly creating identical duration objects for every loop
iteration.

* date: Add `Z_PARAM_ULONG()` helper to `time_duration.c`

* date: Make `tests/time/duration/helper.inc` compatible with PHP < 8.6

This will allow polyfills to more easily consume the upstream tests.

* NEWS / UPGRADING

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2026-08-07 12:04:40 +02:00
Ilija Tovilo 070f8b2186 Adjust XtOffsetOf() to offsetof() for master 2026-07-15 20:53:05 +02:00
Ilija Tovilo 80a147a182 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix leak on double DatePeriod::__construct() call
2026-07-15 20:50:17 +02:00
Ilija Tovilo 670ccf8d02 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix leak on double DatePeriod::__construct() call
2026-07-15 20:50:11 +02:00
Ilija Tovilo 0fbd1043da Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix leak on double DatePeriod::__construct() call
2026-07-15 20:40:15 +02:00
Ilija Tovilo f3c50bfb1b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix leak on double DatePeriod::__construct() call
2026-07-15 20:39:51 +02:00
Ilija Tovilo 2d86f8cf48 Fix leak on double DatePeriod::__construct() call
Closes GH-22643
2026-07-15 20:38:23 +02:00
Derick Rethans a71a32122b Merge branch 'PHP-8.5'
* PHP-8.5:
  Fixed __debugInfo() usage on PHP 8.5 and later for DatePeriod (#22677)
2026-07-10 16:52:52 +01:00
Derick Rethans 032b2d392d Fixed __debugInfo() usage on PHP 8.5 and later for DatePeriod (#22677) 2026-07-10 16:52:26 +01:00
Derick Rethans b2011f2ea3 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-11310: __debugInfo does nothing on userland classes extending Date classes (#22655)
2026-07-10 13:39:41 +01:00
Derick Rethans e4dbda9ae7 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-11310: __debugInfo does nothing on userland classes extending Date classes (#22655)
2026-07-10 13:39:17 +01:00
Derick Rethans 8b1079a890 Fix GH-11310: __debugInfo does nothing on userland classes extending Date classes (#22655)
* Fix GH-11310: __debugInfo does nothing on userland classes extending Date classes

* Add tests to make sure not calling the parent constructor has any effect
2026-07-10 13:38:56 +01:00
Derick Rethans 3c15cf1e4f Add support for -1 as valid year for idate() output. (#22657)
* Add support for -1 as valid year for idate() output.

Closes GH-13273

* Simplify error handling

* Add note in UPGRADING.INTERNALS about API change
2026-07-10 13:37:11 +01:00
ndossche 03b148ce42 Merge branch 'PHP-8.5'
* PHP-8.5:
  date: Fix typo in condition in date_period_init_iso8601_string()
2026-06-11 22:18:23 +02:00
ndossche 00d7f85afb Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  date: Fix typo in condition in date_period_init_iso8601_string()
2026-06-11 22:18:15 +02:00
ndossche f11c1facb4 date: Fix typo in condition in date_period_init_iso8601_string()
Now the address is being checked instead of the value, but I believe the
value should be checked against 0, not the pointer against NULL.

Closes GH-22253.
2026-06-11 22:17:39 +02:00
Tim Düsterhus 5212b816d2 zend_objects: Make old_object a const* in zend_objects_clone_members() (#22089)
* zend_objects: Make `old_object` a `const*` in `zend_objects_clone_members()`

* tree-wide: Make the original object `const` in `clone_obj` handlers
2026-05-19 14:16:03 +02:00
Ilia Alshanetsky 696ea500d3 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-18422: int overflow in php_date_llabs
2026-05-18 14:47:32 -04:00
Ilia Alshanetsky 1746b58eaf Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-18422: int overflow in php_date_llabs
2026-05-18 14:47:31 -04:00
Ilia Alshanetsky 09ca095aa8 Fix GH-18422: int overflow in php_date_llabs
php_date_llabs negated its argument with -i, which is UB when i is
LLONG_MIN. Cast to uint64_t before negating and use stdint types
throughout. Updated Y/x/X format call sites to PRIu64.

Fixes GH-18422
Closes GH-21638
2026-05-18 14:39:55 -04:00
Tim Düsterhus 7114314c5a tree-wide: Replace XtOffsetOf by its definition (#21899)
`offsetof()` is in `stddef.h` and thus always available. The extra macro is an
unnecessary layer of indirection.
2026-04-28 22:12:56 +02:00
Ben Ramsey ae9b02891a license-update: ext/date source headers
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00
Tim Düsterhus 04f06e8cf2 zend_portability: Remove EMPTY_SWITCH_DEFAULT_CASE() (#20063)
There are several issues with this macro:

- It is incorrectly named: It's not an empty default case. It's an unreachable
  default case.
- It is hiding control flow in its definition, which can be confusing for
  humans and tools (such as Coccinelle) alike, because it looks like it would
  be a statement that belongs to the "current" case rather than opening a new
  one.

Since this macro is exactly as long as explicitly spelling out its definition
(excluding the useless `break;`), it is not even making the code any more
succinct.
2026-04-06 14:46:15 +02:00
Gina Peter Banyard cd753007ce Audit INI functions and macros, and replace them with better alternatives (#21146)
Audit zend_ini_string(), INI_STR(), and related functions and macros, and all other INI_* macros.

The primary motivation is that these APIs should return a `const char*` because the `char*` is owned by a zend_string, and thus should never be released.

Moreover, the INI_STR() API doesn't follow our usual naming scheme as it returns a char* rather than a zend_string*.

In this PR new zend_ini_{bool|long|double|str|string}_literal() macros are introduced replacing the INI_{BOOL|INT|FLT|STR} macros which follow our more modern naming convention.
Moreover, the INI_BOOL() macro didn't produce correct values if the INI string is a word like "true" or "on".

The INI_ORIG_* APIs are removed because a Sourcegraph search shows 0 results, other than the one case used in ext/tidy that we fix using the typical API.

Add some additional checks for the value of an INI string to ensure it doesn't contain a nul byte when describing a path.
2026-03-30 14:48:12 +01:00
Weilin Du 2918caee20 ext/*: Remove break after return (#21485) 2026-03-23 20:30:13 +01:00
ndossche 46e8cb9ff4 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix timezone offset with seconds losing precision
2026-02-05 18:39:22 +01:00
ndossche e76044aa0b Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix timezone offset with seconds losing precision
2026-02-05 18:39:18 +01:00
Niels Dossche ee26417b58 Fix timezone offset with seconds losing precision
There are two issues:
1. The 'e' formatter doesn't output the seconds of the timezone even if
   it has seconds.
2. var_dump(), (array) cast, serialization, ... don't include the
   timezone second offset in the output. This means that, for example,
   serializing and then unserializing a date object loses the seconds of
   the timezone. This can be observed by comparing the output of
   getTimezone() for `$dt` vs the unserialized object in the provided test.

Closes GH-20764.
2026-02-05 18:38:54 +01:00
ndossche b860837b78 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20936: DatePeriod::__set_state() cannot handle null start
2026-02-04 18:36:17 +01:00
ndossche 34a341e59f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20936: DatePeriod::__set_state() cannot handle null start
2026-02-04 18:35:29 +01:00
Niels Dossche 7445b0f6d9 Fix GH-20936: DatePeriod::__set_state() cannot handle null start
The "current" and "end" field also rely on start_ce, which is set by
"start". Therefore, if "current" or "end" are provided, so must "start"
be provided.

Closes GH-20939.
2026-02-04 18:34:38 +01:00
Arshid 5ce36453d6 [skip ci] Use STANDARD_MODULE_HEADER for ext-date (GH-21080) 2026-01-29 17:19:14 +01:00
Niels Dossche d86182f7ef date: Avoid passing objects using double pointers
Using single pointers is cleaner and also generates better machine code.
2026-01-13 18:53:43 +01:00
Niels Dossche 3c654a8574 date: Remove unused argument for internal functions 2026-01-13 18:53:43 +01:00
Niels Dossche 31ac5e481c Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix crashes when trying to instantiate uninstantiable classes via date static constructors
2025-11-06 21:30:04 +01:00
Niels Dossche ad5e182e0a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix crashes when trying to instantiate uninstantiable classes via date static constructors
2025-11-06 21:29:54 +01:00
Niels Dossche ca084ac88a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix crashes when trying to instantiate uninstantiable classes via date static constructors
2025-11-06 21:29:43 +01:00
Niels Dossche d3a4b4b09c Fix crashes when trying to instantiate uninstantiable classes via date static constructors
Closes GH-20361.
2025-11-06 21:21:24 +01:00
Tim Düsterhus 34c71f8176 date: Use true / false instead of 1 / 0 for bool parameters
Changes done with Coccinelle:

    @r1@
    identifier F;
    identifier p;
    typedef bool;
    parameter list [n1] PL1;
    parameter list [n2] PL2;
    @@

    F(PL1, bool p, PL2) {
    ...
    }

    @r2@
    identifier r1.F;
    expression list [r1.n1] EL1;
    expression list [r1.n2] EL2;
    @@

    F(EL1,
    (
    - 1
    + true
    |
    - 0
    + false
    )
    , EL2)
2025-09-24 18:51:40 +02:00