Commit graph

1033 commits

Author SHA1 Message Date
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
Máté Kocsis
adc26424aa Deprecate calling DatePeriod::__construct() with less than 3 arguments 2023-12-04 22:27:59 +01:00
Marc Bennewitz
88f2dc6268 Added DateTime[Immutable]::createFromTimestamp / date_create_[immutable]_from_timestamp 2023-11-22 15:24:13 +00:00
Ilija Tovilo
692cea5cbc
Use zend_error_noreturn for E_ERROR consistently
To be clear, these already don't return. zend_error_noreturn just hints at this
fact through the ZEND_NORETURN attribute.

Closes GH-12204
2023-09-14 11:44:55 +02:00
Derick Rethans
1bddd4ef44 Merge branch 'PHP-8.2' 2023-08-10 12:11:35 +01:00
Derick Rethans
e157da11f3 Update initialisation check for new PHP-8.3 API 2023-08-09 20:12:41 +01: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
f8b42da3a4 Merge branch 'PHP-8.2' 2023-08-09 15:39:31 +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
82ff4c5e84 Make the new DatePeriod::createFromISO8601String method emit DateTimeImmutable objects 2023-07-25 18:43:45 +01:00
Derick Rethans
b669cb4c1b CS 2023-07-25 18:43:45 +01:00
Máté Kocsis
9c7c0a0b93 Implement DatePeriod::createFromISO8601String() 2023-07-18 12:59:21 +02:00
Derick Rethans
783197623d Merge branch 'PHP-8.2' 2023-06-22 19:06:21 +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
nielsdos
12e4628815 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-11455: Segmentation fault with custom object date properties
  Revert "Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM"
2023-06-19 19:45:24 +02: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
505a30cbbc Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-11281: DateTimeZone::getName() does not include seconds in offset
2023-05-23 18:57: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
7e224195ab Merge branch 'PHP-8.2' 2023-03-23 14:51:24 +00: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
Ilija Tovilo
9d5f2f1343
Use new ZSTR_INIT_LITERAL macro (#10879) 2023-03-20 16:19:05 +01:00
Derick Rethans
b96a382419 Merge branch 'PHP-8.2' 2023-03-13 11:04:01 +00:00
Derick Rethans
ce5f75fb6f Fixed oss-fuzz #56931 2023-03-13 09:38:11 +00:00
Derick Rethans
afd42610c0 Merge branch 'PHP-8.2' 2023-03-10 14:43:51 +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
Max Kellermann
1287747a9a
ext: make various internal functions static (#10650)
Namely in:
* ext/date
* ext/libxml
* ext/dba
* ext/curl
2023-02-21 15:51:41 +00:00
Max Kellermann
263b22f374
Make lots of string pointers const (#10646)
This allows using string literals without implicitly casting away the
`const`.
2023-02-21 14:01:37 +00:00