Commit graph

1013 commits

Author SHA1 Message Date
Niels Dossche
06f592820d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in tidy output handler on error
  Fix leaks with multiple calls to DatePeriod iterator current()
2025-05-26 19:42:20 +02:00
Niels Dossche
ff2c7dc0f8
Fix leaks with multiple calls to DatePeriod iterator current()
Destroy the old value first. We can't skip recreating the value because
the object may have been changed in between calls.

Closes GH-18624.
2025-05-26 19:40:41 +02:00
David Carlier
004d7cd290
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-03 16:56:32 +01:00
David Carlier
0227d96f48
Fix GH-18481: date_sunrise check sun rise with offset if is finite/is nan
close GH-18484
2025-05-03 16:56:09 +01:00
Derick Rethans
d54aee5b0c
Merge branch 'PHP-8.3' into PHP-8.4 2025-04-22 17:11:15 +01:00
Carlos Buenosvinos
c9f3127ca8
Fix GH-18076: date_sun_info() function returns inaccurate sunrise and sunset times
Closes GH-18317: Avoid double counting the 15 minutes radial correction of the sun
2025-04-22 16:45:57 +01:00
Niels Dossche
a019fbd970
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18309: ipv6 filter integer overflow
  Fix GH-18304: Changing the properties of a DateInterval through dynamic properties triggers a SegFault
2025-04-11 23:36:12 +02:00
Niels Dossche
ba0853888d
Fix GH-18304: Changing the properties of a DateInterval through dynamic properties triggers a SegFault
For dynamic fetches the cache_slot will be NULL, so we have to check for
that when resetting the cache. For zip and xmlreader this couldn't
easily be tested because of a lack of writable properties.

Closes GH-18307.
2025-04-11 23:33:58 +02:00
Niels Dossche
ee4a9a4a7c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17736: Assertion failure zend_reference_destroy()
2025-03-02 22:37:07 +01:00
Niels Dossche
ce8ab5f16a
Fix GH-17736: Assertion failure zend_reference_destroy()
The cache slot for FETCH_OBJ_W in function `test` is primed with the
class for C. The next call uses a simplexml instance and reuses the same
cache slot. simplexml's get_property_ptr handler does not use the cache
slot, so the old values remain in the cache slot. When
`zend_handle_fetch_obj_flags` is called this is not guarded by a check
for the class entry. So we end up using the prop_info from the property
C::$a instead of the simplexml property.

This patch adds a reset to the cache slots in the property address fetch
code and also in the extensions with a non-standard reference handler.
This keeps the run time cache consistent and avoids the issue without
complicating the fast paths.

Closes GH-17739.
2025-03-02 22:33:32 +01:00
David Carlier
aa815f32ae
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-20 15:09:49 +00:00
David Carlier
16c0e57530
Fix GH-14709 overflow on recurrences for DatePeriod::__construct
close GH-14710
2024-12-20 15:03:47 +00:00
Christoph M. Becker
68d3000902
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-14732: date_sun_info() fails for non-finite values
2024-11-01 23:50:40 +01:00
Christoph M. Becker
8df513336a
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14732: date_sun_info() fails for non-finite values
2024-11-01 23:47:21 +01:00
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
9923e14d97
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-18 12:38:21 +01:00
Derick Rethans
8acdde5b10
Merge branch 'PHP-8.2' into PHP-8.3 2024-10-18 12:38:06 +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
66fe549daf
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16454: Unhandled INF in date_sunset() with tiny $utcOffset
2024-10-18 13:25:05 +02:00
Christoph M. Becker
64f312f123
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16454: Unhandled INF in date_sunset() with tiny $utcOffset
2024-10-18 13:22:55 +02: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
Máté Kocsis
274ae05c4e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Add missing returns in ext/date for PHP 8.3+ (#15735)
2024-09-14 22:15:49 +02:00
Máté Kocsis
cb69900407
Add missing returns in ext/date for PHP 8.3+ (#15735)
Issues originally found in #15598
2024-09-14 22:15:22 +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
e255889fea
Merge branch 'PHP-8.3' 2024-09-11 16:41:35 +01:00
Derick Rethans
9ebdbe2f41
Merge branch 'PHP-8.2' into PHP-8.3 2024-09-11 16:41:30 +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
7dfbf4d1b7
Merge branch 'PHP-8.3'
* PHP-8.3:
  Add missing return for DatePeriod::__unserialize
2024-09-03 21:32:03 +02:00
Máté Kocsis
1663ed6c6e
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add missing return for DatePeriod::__unserialize
2024-09-03 21:31:00 +02: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
Máté Kocsis
09c498233e
Use ZEND_UNCOMPARABLE for consistency 2024-08-28 22:39:23 +02:00
Marc Bennewitz
d6113ba8fe
fixes #13773: DatePeriod does not take microseconds into account 2024-08-21 10:57:46 +01:00
Arnaud Le Blanc
1fbb666545
Use zend_std_build_properties() to access zend_object.properties
The zend_object.properties HashTable needs to be built just in time by calling
rebuild_object_properties() on the object before accessing it. Normally this is
done automatically in zend_std_get_properties(), but we do it manually in a few
places.

In this change I introduce an inline variant of zend_std_build_properties(), and
refactor these places to use it instead of calling rebuild_object_properties()
manually.

rebuild_object_properties() renamed as rebuild_object_properties_internal(), to
enforce usage of zend_std_get_properties() or zend_std_build_properties_ex().

Closes GH-14996
2024-07-18 22:18:38 +02:00
Ilija Tovilo
a26ec58fa1
De-duplicate readonly property modification error message (#14972) 2024-07-16 16:29:40 +02:00
Tim Düsterhus
29f98e7485
Replace @deprecated by #[\Deprecated] for internal functions / class constants (#14750)
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-07-10 16:47:31 +02:00
Saki Takamachi
bfc988552f
Fixed GH-14383: Fixed usec was carry up (#14463)
If round to the fractional part of a timestamp, a carry will occur in cases
such as 999 999 9. In that case, set usec to 0 and add/sub 1 to sec.
2024-06-11 19:02:43 +09:00
Peter Kokot
84a0da1574
Sync #if/ifdef/defined (#14508)
This syncs CPP macro conditions:
- _WIN32
- _WIN64
- HAVE_ALLOCA_H
- HAVE_ALPHASORT
- HAVE_ARPA_INET_H
- HAVE_CONFIG_H
- HAVE_DIRENT_H
- HAVE_DLFCN_H
- HAVE_GETTIMEOFDAY
- HAVE_LIBDL
- HAVE_POLL_H
- HAVE_PWD_H
- HAVE_SCANDIR
- HAVE_SYS_FILE_H
- HAVE_SYS_PARAM_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_TIME_H
- HAVE_SYS_TYPES_H
- HAVE_SYS_WAIT_H
- HAVE_UNISTD_H
- PHP_WIN32
- ZEND_WIN32

These are either undefined or defined to 1 in Autotools and Windows.

Follow up of GH-5526 (-Wundef).
2024-06-09 14:23:41 +02:00
Gina Peter Banyard
fd2d869642
Clean-up some more headers (#14416)
Remove unused headers (such as php_ini.h for extensions that don't define INI settings)
Use more specific headers when possible
2024-06-08 17:15:36 +01:00
Gina Peter Banyard
8f6612aca0 ext/date: Fix some [-Wsign-compare] warnings 2024-06-08 17:15:01 +01:00
Peter Kokot
da86eec3db
Sync #if/ifdef/defined (#14371)
These are either undefined or defined to value 1 in Autotools and
Windows:
- HAVE_COMMONCRYPTO_COMMONRANDOM_H
- HAVE_EXIF
- HAVE_FOPENCOOKIE
- HAVE_IF_NAMETOINDEX
- HAVE_LIBICONV
- HAVE_SOCKETS
- HAVE_STRUCT_STAT_ST_RDEV
- HAVE_STRUCT_TM_TM_GMTOFF
- HAVE_STRUCT_TM_TM_ZONE

Follow up of GH-5526 (-Wundef)
2024-06-07 23:45:17 +02:00
Derick Rethans
92d18b2bec
Fixed rounding error with new DateTime[Immutable]::createFromTimestamp method 2024-05-30 14:08:39 +01:00
Cristian Rodríguez
8e62e2b829
Mark multple functions as static (#13864)
* Mark many functions as static

Multiple functions are missing the static qualifier.

* remove unused struct sigactions

struct sigaction act, old_term, old_quit, old_int;
all unused.

* optimizer: minXOR and maxXOR are unused
2024-05-22 13:11:46 +02:00
Derick Rethans
bc9a113a07
Add further ZPP conversions 2024-05-22 10:40:49 +01:00
Max Semenik
6f5ffc2915
ext/date: convert remaining uses of zend_parse_parameters() 2024-05-22 10:40:49 +01:00
Marc Bennewitz
805326fe18
An uninitialized DateTime is UNEXPECTED (#13492) 2024-03-18 16:38:30 +00:00
Marc Bennewitz
dbd976a67f
Singular DateTime::[get|set]Microsecond & no tentative return type (#13486)
* Singular DateTime::[get|set]Microsecond & no tentative return type

* Added missing getMicrosecond to DateTimeInterface
2024-03-06 09:18:22 +00:00
Marc Bennewitz
9f586f6c69
Fixed int32 underflow on DateTime::createFromTimestamp (#12775)
* Fixed int32 underflow on DateTime::createFromTimestamp
2024-02-27 14:01:49 +00:00
Marc Bennewitz
0016b3085c
Added DateTime[Immutable]::[get|set]Microseconds (#12557)
* Added DateTime[Immutable]::[get|set]Microseconds
2024-02-05 12:14:18 +00:00
David CARLIER
9726721560
general signatures discrepencies fixes (#13122) 2024-01-10 22:19:23 +00:00
Niels Dossche
b34b4d54c3 Fix #44383: PHP DateTime not converted to xsd:datetime
Closes GH-12437.
Closes GH-11725.
2023-12-08 17:26:52 +01:00