51 Commits
Author SHA1 Message Date
Gina Peter Banyard 1cb9d87ee5 intl: use C++ linkage instead of C linkage when easily possible
intl: use C++ linkage for BreakIterator PHP functions/methods

intl: use C++ linkage for common code

intl: use C++ linkage for Spoofchecker PHP methods

intl: use C++ linkage for IntlNumberRangeFormatter PHP methods

intl: use C++ linkage for IntlNumberFormatter PHP methods

intl: No need to extern C the arginfo header for IntlListFormatter

intl: use C++ linkage for resourcebundle_get_iterator

Closes GH-24625
2026-10-24 15:43:26 +01:00
Gina Peter Banyard c0250bac3a intl: stop including headers as C extern (#24617)
Except for arginfo header as PHP_FUNCTION/PHP_METHOD are marked as U_CFUNC and the `ext/date/php_date.h` header doesn't use extern C.

We now specificy the header symbols that _need_ to follow the C function ABI, meaning in some places we drop U_CFUNC declarations and in others we add it.

Also use the `BEGIN_EXTERN_C()` portability macro when possible so that searching for this is easier.
2026-10-23 21:51:52 +01:00
Gina Peter Banyard 57d14d47c8 intl: make breakiterator_object_construct() private 2026-10-23 19:10:20 +01:00
Ilia Alshanetsky 25466f7de0 Merge branch 'PHP-8.5'
* PHP-8.5:
  Keep compiled RuleBasedBreakIterator rules alive for the iterator
2026-08-28 09:16:18 -04:00
Ilia Alshanetsky 35b09eaead Keep compiled RuleBasedBreakIterator rules alive for the iterator
The ICU compiled-rules constructor aliases the caller's buffer. PHP
passed the argument string and did not retain it, so a later
setText/next can use freed memory. Hold a zend_string copy on the
object and release it in free_obj; clone addrefs it.

Closes GH-23322
2026-08-28 09:11:50 -04: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
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 bb068359d4 license-update: ext/intl source headers
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00
Gina Peter Banyard 33f1cf202e ext/intl: Various refactoring (#14360)
* ext/intl: Small extension cleanup

* ext/intl: Normalize cloning error handling behaviour

Always throw a Error exception as we cannot progress from here

* ext/intl: idn.c use ValueErrors where appropriate

Drive-by refactoring

* ext/intl: Remove some unused headers

Probably more cleanup can be done
2024-05-30 12:51:36 +01:00
Bob Weinand 94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis 559d5030a8 Declare ext/intl constants in stubs - part 10 (#9280) 2022-08-09 11:19:23 +02: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
Máté Kocsis c6723728df Generate ext/intl class entries from stubs
Closes GH-6670
2021-02-09 13:37:24 +01:00
Nikita Popov 259d050a39 Clean up BreakIterator create_object handler
Use standard zend_object_alloc() function and fix the
object_init_properties() call (which works out okay because there
are no properties).
2020-08-25 13:11:43 +02:00
Nikita Popov ff19ec2df3 Introduce InternalIterator
Userland classes that implement Traversable must do so either
through Iterator or IteratorAggregate. The same requirement does
not exist for internal classes: They can implement the internal
get_iterator mechanism, without exposing either the Iterator or
IteratorAggregate APIs. This makes them usable in get_iterator(),
but incompatible with any Iterator based APIs.

A lot of internal classes do this, because exposing the userland
APIs is simply a lot of work. This patch alleviates this issue by
providing a generic InternalIterator class, which acts as an
adapater between get_iterator and Iterator, and can be easily
used by many internal classes. At the same time, we extend the
requirement that Traversable implies Iterator or IteratorAggregate
to internal classes as well.

Closes GH-5216.
2020-06-24 15:31:41 +02:00
Máté Kocsis f00bcfbb7d Generate method entries for ext/intl
Closes GH-5370
2020-04-14 13:39:00 +02:00
Nikita Popov fb5bfcb75b Add a ZEND_UNCOMPARABLE value
To explicitly indicate that objects are uncomparable. For now
this has no functional difference from the usual 1 return value,
but makes intent clearer.
2020-03-31 12:36:48 +02:00
Máté Kocsis 81fee9f29f Get rid of method mapping of BreakIterator classes 2020-02-25 23:05:24 +01:00
Máté Kocsis bcb7847139 Add stubs for Intl BreakIterator
Closes GH-5207
2020-02-25 23:05:03 +01:00
Dmitry Stogov b02b81299c Comparison cleanup:
- introduce zend_compare() that returns -1,0,1 dirctly (without intermediate zval)
- remove compare_objects() object handler, and keep only compare() handler
2019-10-07 17:57:49 +03:00
Gabriel Caruso 5d6e923d46 Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Dmitry Stogov 91ef4124e5 Refactor zend_object_handlers API to pass zend_object* and zend_string* insted of zval(s). 2019-02-04 13:20:25 +03:00
Christoph M. Becker 8a4c2f1621 Require ICU ≥ 50.1
Given that ICU is a set of lively developed libraries, that ICU 50.1
has been released on 2012-11-05, and PHP 7.4 is scheduled to be
released seven years after it, we consider it appropriate to ditch
these legacy versions.

Particularly, that would be a reasonable groundwork to implement part
two of the “Deprecate and remove INTL_IDNA_VARIANT_2003” RFC[1], namely
to default idn_to_ascii()'s and idn_to_utf8()'s $variant parameter to
INTL_IDNA_VARIANT_UTS46, which is not defined in ICU < 4.6.

See also the related discussion on internals@[2].

[1] <https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003>
[2] <http://news.php.net/php.internals/101626>ff
2018-09-15 13:59:54 +02:00
Christoph M. Becker 1b61c3b210 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix #76556: get_debug_info handler for BreakIterator shows wrong type
2018-06-30 23:22:20 +02:00
Christoph M. Becker 1118fca75d Fix #76556: get_debug_info handler for BreakIterator shows wrong type
We use the retrieved type for the "type" element instead of the text.
This has been confused during the PHP 7 upgrade[1].

[1] http://git.php.net/?p=php-src.git;a=commit;h=1d793348067e5769144c0f7efd86428a4137baec
2018-06-30 23:15:02 +02:00
Dmitry Stogov f2b4ec4bdc Export standard object handlers, to avoid indirect access 2018-05-31 11:57:22 +03:00
Anatol Belski d8200e4885 Simplify namespace access
The icu namespace is an alias which resolves to the real namespace.
2018-04-01 01:03:40 +02:00
Anatol Belski 8d35a42383 Utilize the recommended way to handle the icu namespace 2018-03-31 18:51:56 +02:00
Dmitry Stogov 44e0b79ac6 Refactored array creation API. array_init() and array_init_size() are converted into macros calling zend_new_array(). They are not functions anymore and don't return any values. 2017-09-20 02:25:56 +03:00
Nikita Popov 29af302395 Remove useless dtor handlers in intl
These are only indirections to the default handler
2016-07-16 23:16:43 +02:00
Dmitry Stogov 4a2e40bb86 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 04:05:24 +03:00
Anatol Belski bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Johannes Schlüter d0cb715373 s/PHP 5/PHP 7/ 2014-09-19 18:33:14 +02:00
Anatol Belski c3e3c98ec6 master renames phase 1 2014-08-25 19:24:55 +02:00
Anatol Belski 63d3f0b844 basic macro replacements, all at once 2014-08-19 08:07:31 +02:00
Xinchen Hui 9fb8c16b6c Fixed temporarily un-expected object re-init 2014-06-29 15:28:55 +08:00
Xinchen Hui 1d79334806 Fixed get_debug_info 2014-06-28 23:30:46 +08:00
Xinchen Hui b6e9c76d67 Refactoring ext/intl (only compilerable now, far to finish :<) 2014-06-28 12:20:35 +08:00
Xinchen Hui 4fbaddb4f8 Refactoring ext/intl (incompleted) 2014-06-28 00:02:50 +08:00
Dmitry Stogov 050d7e38ad Cleanup (1-st round) 2014-04-15 15:40:40 +04:00
Dmitry Stogov f4cfaf36e2 Use better data structures (incomplete) 2014-02-10 10:04:30 +04:00
Gustavo André dos Santos Lopes 3363e04fb4 intl: remove extra quotes from arginfo params 2013-07-21 03:30:28 +02:00
Gustavo Lopes b4ba46cb99 Fix arginfo of BreakIterator::getLocale 2013-01-29 19:06:14 +01:00
Gustavo André dos Santos Lopes d8b067e66f BreakIterator: fix compat with old ICU versions 2012-06-25 12:05:13 +02:00
Gustavo André dos Santos Lopes 77daa3482d BreakIterator::getPartsIterator: new optional arg
Can take one of:
* IntlPartsIterator::KEY_SEQUENTIAL (keys are 0, 1, ...)
* IntlPartsIterator::KEY_LEFT (keys are left boundaries)
* IntlPartsIterator::KEY_LEFT (keys are right boundaries)

The default is IntlPartsIterator::KEY_SEQUENTIAL (the previous behavior).
2012-06-22 18:52:06 +02:00
Gustavo André dos Santos Lopes 0a7ae87e91 Added IntlCodePointBreakIterator.
Objects of this class can be instantiated with

IntlBreakIterator::createCodePointInstance()

The method does not take a locale, as it would not make sense in this
context.

This class has one additional method:

long IntlCodePointIterator::getLastCodePoint()

which returns either -1 or the last code point we moved over, if any
(and discounting any movement before the last call to
IntlBreakIterator::first() or IntlBreakIterator::last()).
2012-06-22 18:19:54 +02:00
Gustavo André dos Santos Lopes cee31091a9 Add Intl prefix to BreakIterator/RuleBasedBI 2012-06-10 22:42:38 +02:00
Gustavo André dos Santos Lopes 87dd0269ba Remove trailing space 2012-06-10 13:26:28 +02:00
Gustavo André dos Santos Lopes afed66bb9e BreakIter: Removed getAvailableLocales/getHashCode 2012-06-10 00:05:00 +02:00
Gustavo André dos Santos Lopes c6593a0e9b BreakIterator: add rules status constants 2012-06-04 23:09:10 +02:00