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
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
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
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.
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.
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.
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*.
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.
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.