Commit Graph

1304 Commits

Author SHA1 Message Date
Máté Kocsis
d6264b0966
Verify parameter names of function aliases
Closes GH-6335
2020-10-16 10:56:33 +02:00
Nikita Popov
5e34744fd9 Initialize calendar_long variable
As reported by cmb, this results a VC runtime warning. I don't
believe there's a problem here, as we only use calendar_long if
both calendar_is_null and calendar_obj are not set, but it doesn't
hurt to initialize it either...
2020-10-14 11:57:05 +02:00
Máté Kocsis
186612e4d7
Improve parameter names in ext/intl
Closes GH-6309
2020-10-12 18:06:45 +02:00
Nikita Popov
6edad1716d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  intl: report more information about message pattern parse errors
2020-10-12 16:44:18 +02:00
Philip Hofstetter
74cf2eb83f intl: report more information about message pattern parse errors
The message patterns can be pretty complex, so reporting a generic
U_PARSE_ERROR without any additional information makes it needlessly
hard to fix erroneous patterns.

This commit makes use of the additional UParseError* parameter to
umsg_open to retrieve more details about the parse error to report that
to the user via intl_get_error_message()

Additional improve error reporting from the IntlMessage constructor.
Previously, all possible failures when calling IntlMessage::__construct()
would be masked away with a generic "Constructor failed" message.
This would include invalid patterns.

This commit makes sure that the underlying error that caused the
constructor failure is reported as part of the IntlException error
message.

Closes GH-6325.
2020-10-12 16:42:41 +02:00
Máté Kocsis
503999910b
More precise type information for datefmt_format() 2020-10-09 11:05:42 +02:00
Nikita Popov
f82414e935 Fix out of bounds offset handling with empty needle
For strrpos with positive out of bounds offsets was not detected.
2020-10-01 16:41:51 +02:00
Christian Schneider
7af24eaedd Allow empty needle in grapheme_str*pos, grapheme_str*str
For consistency with str* and mb_str* functions.

Closes GH-6245.
Closes php/php-tasks#20.
2020-10-01 16:33:58 +02:00
Matteo Beccati
43ce7846d2 Skip test with ICU version < 58 2020-09-26 10:47:56 +02:00
George Peter Banyard
a91cb2f48c Promote warning to ValueError for Spoofchecker::setRestrictionLevel()
Closes GH-6197
2020-09-25 17:55:31 +01:00
Nikita Popov
13b791c79c Normalize substr() behavior
Make the behavior of substr(), mb_substr(), iconv_substr() and
grapheme_substr() consistent when it comes to the handling of
out of bounds offsets. substr() will now always clamp out of
bounds offsets to the string boundary. Cases that previously
returned false will now return an empty string. This means that
substr() itself *always* returns a string now (like mb_substr()
already did before.)

Closes GH-6182.
2020-09-25 09:58:21 +02:00
Nikita Popov
73631e517f Try to fix test 2020-09-22 17:04:06 +02:00
Nikita Popov
6436ddbfc8 Handle out-of-bounds offset consistently in grapheme_* API
Make sure we throw the same kind of error regardless of whether
the offset is out-of-bounds in the fast path or in the slow
path.
2020-09-22 17:01:06 +02:00
Nikita Popov
1312c417de Fix grapheme out of bounds check
An offset equal to the string length is not out of bounds.
2020-09-22 16:38:53 +02:00
George Peter Banyard
ddd99a7005 Drop -1 mode for collator_is_numeric()
It is used only once with allow_errors enabled
2020-09-21 16:29:10 +01:00
George Peter Banyard
2b6f5eec6c Drop Hex support in numeric strings for Intl collator
Support for this was removed in PHP 7.0.

See: https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings
2020-09-21 16:29:10 +01:00
Máté Kocsis
e950ca13ea
Consolidate the usage of "either" and "one of" in error messages
Closes GH-6173
2020-09-20 19:41:47 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis
c76910cd96
Display types in stubs more uniformly
In preparation for generating method signatures for the manual.

This change gets rid of bogus false|null return types, a few unnecessary trailing backslashes, and settles on using ? when possible for nullable types.
2020-09-16 21:19:36 +02:00
Máté Kocsis
46c0c82a0f
Declare array|int and object-of-class|int types in stubs
Closes GH-6081

Co-Authored-By: Nikita Popov <nikic@php.net>
2020-09-14 11:59:32 +02:00
Máté Kocsis
c98d47696f
Consolidate new union type ZPP macro names
They will now follow the canonical order of types. Older macros are
left intact due to maintaining BC.

Closes GH-6112
2020-09-11 11:00:18 +02:00
Máté Kocsis
9975986b7e
Improve error messages mentioning parameters instead of arguments
Closes GH-5999
2020-09-09 10:47:43 +02:00
Máté Kocsis
fd0b39905c
Promote warnings to exceptions in ext/intl
Closes GH-5972
2020-09-07 19:46:55 +02:00
Máté Kocsis
8107a1da5a
Use ZPP instead of custom type checks
We can add these types as a native type declaration to stubs as a side-effect. Closes GH-6068
2020-09-04 14:32:34 +02:00
Máté Kocsis
f7fbc6333f
Add more precise type info for stubs
Closes GH-6005
2020-09-01 16:35:56 +02:00
Nikita Popov
f593019819 Prevent ResourceBundle double-construction 2020-08-26 10:25:15 +02:00
Nikita Popov
6b554251f7 Prevent double-construction of NumberFormatter 2020-08-26 10:25:09 +02:00
Nikita Popov
72eaf509d3 Prevent double-construction of IntlGregorianCalendar 2020-08-26 10:24:57 +02:00
Nikita Popov
f6e5cc3391 Prevent double-construction of IntlRuleBasedBreakIterator 2020-08-26 10:03:28 +02:00
Nikita Popov
647fb38d58 Ensure RuleBasedBreakIterator constructor throws on failure
Constructors must throw on failure indepdendent of the configured
intl error mode.
2020-08-25 15:28:58 +02: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
da0a0a13be Fixed bug #79946
Declare __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS via -D
to make sure they are declared before the first stdint.h include.
We also define these in php_stdint.h, but don't always include that
file first.

This is necessary for old compilers that use C99 rather than C11
semantics for stdint.h.
2020-08-10 09:52:22 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Máté Kocsis
046cc5e4c2
Add another round of missing parameter types to stubs
Closes GH-5950
2020-08-07 16:48:45 +02:00
Nikita Popov
8b77c58130 Accept zend_object* in zend_update_property 2020-08-07 16:40:27 +02:00
Máté Kocsis
79981a394e
Add a bunch of missing argument types to stubs 2020-08-03 00:45:51 +02:00
George Peter Banyard
f78a091014 Warning to ValueError promotion in Intl extension Part 1
Affects:
- IntlCalendar
- IntlGregorianCalendar
- IntlBreakIterator

Closes GH-5669
2020-07-31 13:27:22 +01:00
Máté Kocsis
0d330e1a02
Add a few missing parameter types in stubs
Related to GH-5627
2020-07-30 14:26:45 +02:00
Nikita Popov
27ad19c3e8 Validate collator earlier during sort
Check this once before the sort, instead of on every compare.
Also directly store the UCollator to make things more obvious.
2020-07-24 11:58:10 +02:00
Nikita Popov
545928e4b8 Fix some clang warnings 2020-07-23 10:35:40 +02:00
Nikita Popov
4ce9571978 Fix UConvert::getErrorMessage() leak on zpp failure 2020-07-21 12:05:44 +02:00
Nikita Popov
4903f7c5fd Fix IntlGregorianCalendar constructor signature
Give these conversative UNKNOWN defaults and no types, as the
overload is something of a mess.
2020-07-17 12:47:25 +02:00
Máté Kocsis
d30cd7d7e7
Review the usage of apostrophes in error messages
Closes GH-5590
2020-07-10 21:05:28 +02:00
Nikita Popov
302933daea Remove no_separation flag 2020-07-07 09:30:24 +02:00
Nikita Popov
e93aca7167 Explicitly create references in UConverter callbacks
And don't allow separation.
2020-07-07 09:29:21 +02:00
Máté Kocsis
91fbd12d57
Fix a few comments 2020-07-06 21:23:35 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
312201dce4 Add get_gc handle for object iterators
Optional handler with the same semantics as the object handler.
2020-07-01 15:17:22 +02:00
Máté Kocsis
30067894fc
Update outdated arginfo hashes 2020-06-30 16:02:11 +02:00
George Peter Banyard
892b32d839 Drop non-well numeric string in Intl test 2020-06-28 19:30:07 +02:00