Commit graph

1723 commits

Author SHA1 Message Date
Gina Peter Banyard
69f67f990d
ext/intl: Deprecate intl.error_level INI setting (#19430)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_intlerror_level_ini_setting
2025-08-09 16:28:47 +01:00
David CARLIER
2bb98cd8c8
ext/int: IntlTimeZone converting few intl error to exceptions. (#13477) 2025-08-09 12:50:35 +01:00
Gina Peter Banyard
1e108e9ab2
ext/intl: wrap DateTimeZone constructor exception in an IntlException (#19410)
The motivation is two fold:
- Userland code that deals with ext/intl can be expected to handle IntlException but not necessarily ext/date exceptions
- This removes the possibility of superfluous warnings being emitted by ext/intl when an exception has already been thrown
2025-08-09 11:24:11 +01:00
Gina Peter Banyard
43a91089ca
ext/intl: Refactor timezone parameter passing (#19409) 2025-08-08 21:12:43 +01:00
Gina Peter Banyard
fe88711b14
ext/intl: Use ZPP specifier for IntlTimeZone::createEnumeration() (#19393)
The existing code is extremely convoluted, incorrectly documented, and does not follow the usual semantics
2025-08-07 22:37:16 +01:00
David CARLIER
140fc69b4a
ext/intl: update from C to C++ step2. (#19294) 2025-08-07 22:36:34 +01:00
Gina Peter Banyard
43420599f7
ext/intl: better errors for IntlTimeZone::createTimeZoneIDEnumeration (#19395)
IntlTimeZone::createTimeZoneIDEnumeration

And convert those to ValueErrors directly as they are bugs
2025-08-07 13:52:03 +01:00
Gina Peter Banyard
ca5667bc14
ext/intl: prevent creation of invalid UConverter instance (#19396) 2025-08-07 13:46:58 +01:00
Gina Peter Banyard
c42e6d62d8
ext/intl: modernize tests (#19392)
This is effectively removing ZPP tests, enabling warnings, and moving INI settings into the INI PHPT block
2025-08-06 23:33:48 +01:00
Gina Peter Banyard
3fc0149325
[skip ci] drop invalid IntlDateFormat construction error test
The date.timezone INI setting defaults to UTC if an invalid value is provided, meaning that we construct a valid object with timezone UTC.
2025-08-06 22:15:06 +01:00
David CARLIER
9ccd2ba9ff
Fixed GH-19163 fix ext/intl build on midly older compilers but still supporting C++11. (#19353) 2025-08-05 19:09:37 +01:00
Christoph M. Becker
4754d302bf
Fix #19307: PGO builds of shared ext-intl are broken
We resolve the name mangling issue by including the right header file
inside an `extern "C"` declaration.

Closes GH-19310.
2025-07-30 18:33:40 +02:00
Gina Peter Banyard
6600d0e00f
ext/intl: Refactor error handling (#19196)
This is a comprehensive refactoring of the error mechanism of the Intl extension.

By moving the prefixing of the current method/function being executed to actual error message creation by accessing the execution context, we get the following benefits:
- Accurate error messages indicating *what* call caused the error
  - As we *always* "copy" the message, the `copyMsg` arg becomes unused, meaning we can reduce the size of the `intl_error` struct by 4 bytes.
  - Saving it as a zend_string means we know the length of the message
- Remove the need to pass around a "function name" `char*` across multiple calls
- Use Intl's exception mechanism to generate exceptions for constructor call
  - This removes the need for replacing the error handler
  - Which didn't do anything anyway in silent mode, which required throwing non-descriptive exceptions
2025-07-30 16:00:37 +01:00
David CARLIER
abee5c138f
ext/intl: convert C part to C++ step 1. (#19231) 2025-07-29 20:22:19 +01:00
Bogdan Ungureanu
e8b5bcfe19
Intl: IntlListFormatter - update exception message (#19282) 2025-07-29 08:35:27 -07:00
Gina Peter Banyard
b30ccf9158
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/intl: Fix return value on failure for resourcebundle count handler
2025-07-28 15:36:44 +01:00
Gina Peter Banyard
5295fc07d5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/intl: Fix return value on failure for resourcebundle count handler
2025-07-28 15:36:02 +01:00
Gina Peter Banyard
6b0a80903b
ext/intl: Fix return value on failure for resourcebundle count handler
Closes GH-19277
2025-07-28 15:35:31 +01:00
Gina Peter Banyard
191290e194
ext/intl: Split error tests out and stop relying on ut_common() testing (#19266) 2025-07-27 19:40:42 +01:00
David Carlier
f4ad6ea287
Merge branch 'PHP-8.4' 2025-07-27 13:50:30 +01:00
David Carlier
87b4030503
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-27 13:50:21 +01:00
David Carlier
e1c4a0ae51
Fixed GH-19261: msgfmt_parse_message leaks on message format failure.
close GH-19262
2025-07-27 13:49:24 +01:00
David CARLIER
2645663d9b
ext/intl: GregorianCalendar using C++ upcasting operator. (#19216)
when fetching the internal ICU object also removing one useless cast.
2025-07-23 12:25:20 +01:00
David CARLIER
a7fef37657
ext/intl: c++ memory management application to timezone class internals. (#19184) 2025-07-22 05:35:44 +01:00
DanielEScherzer
1eadf553f1
Arginfo: avoid using temporary zvals for initializing attribute values (#19141)
Instead of
* adding a zval on the stack
* initializing it
* copying the value to the attribute

Just initialize the value directly in the zend_attribute_arg
2025-07-21 13:33:51 -07:00
David CARLIER
999d29dc2b
ext/intl: reducing raw pointer usage in C++ part, using smart ones instead. (#19179) 2025-07-20 12:16:04 +01:00
David CARLIER
063d795599
ext/intl: using a bit more modern c++ memory management features. (#19163)
not always possible (e.g. PHP objects) but when scoped we can manage
here to simplify memory managament starting with IntlDateFormat.
2025-07-18 14:10:40 +01:00
Gina Peter Banyard
aadd724362
ext/intl: Refactor IntlRuleBasedBreakIterator::__construct() (#19164)
There is no need to delegate this to a seperate function and overwrite the error handler to promote warnings
2025-07-17 23:00:05 +01:00
Niels Dossche
a22eb4d3e5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix error return check of EVP_CIPHER_CTX_ctrl()
  Fix memleak on failure in collator_get_sort_key()
2025-07-15 20:39:30 +02:00
Niels Dossche
0f731b455c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix error return check of EVP_CIPHER_CTX_ctrl()
  Fix memleak on failure in collator_get_sort_key()
2025-07-15 20:38:22 +02:00
Niels Dossche
b495ce0371
Fix memleak on failure in collator_get_sort_key()
Closes GH-19138.
2025-07-15 20:36:56 +02:00
Daniel Scherzer
142e378618 Arginfo: add and use known strings for attribute values 2025-07-14 17:31:22 -07:00
Peter Kokot
fffe642d67
Remove HAVE_PTRDIFF_T and SIZEOF_PTRDIFF_T (#18968)
The ptrdiff_t is a C89 standard type defined in `<stddef.h>` and widely
available on current platforms. Using it conditionally as in these
occurrences is not needed anymore.
2025-06-28 20:16:12 +02:00
Niels Dossche
737db4a7dc
Use hasThis() where appropriate (#18967)
This macro was introduced to solve false compilers warning about the getThis()
condition not making sense for the address-taken part of the ternary.
2025-06-28 10:12:43 +02:00
Niels Dossche
44955943f9
ext/intl: Use zval_get_tmp_string where possible (#18966) 2025-06-28 10:12:20 +02:00
DanielEScherzer
ddd33fd7e4
Generated arginfo headers: combine preprocessor conditional blocks (2) (#18667)
When global constants' or class constants' availability is based on some
preprocessor condition, the generated arginfo header files wrap the
declarations in the preprocessor `#if` conditional blocks, one per declaration,
even if they are in the same conditional block based on comments in the stub
file. Instead of having multiple conditional blocks one after the other with
the same condition, combine them into a single conditional block.
2025-06-22 14:35:28 -07:00
Bogdan Ungureanu
5f67bace1b
ext/intl: Fix compile issues with ICU versions lower than 67 (#18868) 2025-06-18 09:21:31 +01:00
Niels Dossche
be17e9ed54
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix handling of references in zval_try_get_long()
2025-06-04 21:00:22 +02:00
Niels Dossche
2b383848a7
Fix handling of references in zval_try_get_long()
This API can't handle references, yet everyone keeps forgetting that it
can't and that you should DEREF upfront. Fix every type of this issue
once and for all by moving the reference handling to this Zend API.

Closes GH-18761.
2025-06-04 21:00:05 +02:00
Niels Dossche
233e33fe68
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak in lookup_loc_range()
2025-06-01 11:39:03 +02:00
Niels Dossche
cb0b2a27e3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in lookup_loc_range()
2025-06-01 11:38:51 +02:00
Niels Dossche
d39d261b7e
Fix memory leak in lookup_loc_range()
Closes GH-18723.
2025-06-01 11:38:24 +02:00
Niels Dossche
b8fa1657ff
Avoid string copies in ext/intl after string conversion (#18636)
Introduces intl_convert_utf8_to_utf16_zstr() to convert a UTF-8 string
to a UTF-16 string zend_string* instance. This way we avoid a double
copy later from a UChar* into a zend_string*.
2025-05-25 12:29:36 +02:00
Niels Dossche
5187ff2d17
Fix GH-18566: [intl] Weird numeric sort in Collator
This aligns the behaviour with normal (non-intl) asort() by making the following changes:
  - Use the same trailing whitespace logic as Zend's is_numeric_ex()
  - Don't allow errors on trailing data

Targeting master because of the BC break.

Closes GH-18632.
2025-05-24 14:57:34 +02:00
Niels Dossche
5e21ffe09a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak in intl_datetime_decompose()
2025-05-24 14:56:41 +02:00
Niels Dossche
7efe96d504
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in intl_datetime_decompose()
2025-05-24 14:56:04 +02:00
Niels Dossche
d6836fb345
Fix memory leak in intl_datetime_decompose()
Closes GH-18635.
2025-05-24 14:55:41 +02:00
Bogdan Ungureanu
3f75452454
Intl: Add IntlListFormatter class
Allows to format a list of item with
- TYPE_AND/TYPE_OR/TYPE_UNITS operands.
- WIDTH_WIDE, WIDTH_SHORT, WIDTH_NARROW.

close GH-18519
2025-05-18 15:52:20 +01:00
David CARLIER
9ac5b04487
ext/intl: use RETURN_NEW_STR for intl_get*id_windows_id(). (#18501)
for non interned return values.
2025-05-04 21:44:39 +01:00
David CARLIER
bbac6f5c20
GH-18344 add Locale::addLikelySubtags/Locale::minimizeSubtags support. (#18487)
from a minimized locale, addLikelySubtags augments it with likely
subtags so no changes is the locale is already maximized e.g.
`en_Latn_US`, minimizeSubtags on the other hand does the opposite
operation.
2025-05-03 16:20:18 +01:00