Commit Graph

1375 Commits

Author SHA1 Message Date
Máté Kocsis
b4b980e6ad
Merge branch 'PHP-8.0'
* PHP-8.0:
  Declare a few missing function return types
2021-08-24 11:43:31 +02:00
Máté Kocsis
c58a9f2a57
Declare a few missing function return types
Closes GH-7395
2021-08-24 11:38:50 +02:00
Joe Watkins
05ef6334cd
Fix bug #81303 improve match errors 2021-08-02 17:31:26 +02:00
Nikita Popov
a5ad9eeefa Add explicit IntlPartsIterator::getRuleStatus() method
Rather than doing a magic forward, explicitly add a forwarding
method. This must be the most frivolous use of get_method I've
ever seen.
2021-07-22 10:33:49 +02:00
Nikita Popov
9e787d51b5 Fix typo
Did not have intl enabled in this build...
2021-07-22 09:47:45 +02:00
Nikita Popov
6d505d4445 Add RETURN/RETVAL_COPY_DEREF() macros
These were missing from the set...

I think quite a few of these usages don't actually need the DEREF,
but I've just kept things as is for now.
2021-07-22 09:44:19 +02:00
Máté Kocsis
2378f35787
Use single line phpdoc in stubs where possible 2021-07-20 13:16:56 +02:00
Joe Watkins
570d9b63e9
Not serializable flag permeation 2021-07-20 12:28:35 +02:00
Nikita Popov
9fe4966811 Remove null return type from msgfmt_parse_message()
This doesn't seem to possible. Only false is returned on failure.
2021-07-14 12:00:18 +02:00
Nikita Popov
2afbacc16d Backport some intl stub changes from master
While we're not sure under what circumstances they would fail,
they're fallible on the implementation level.
2021-07-14 11:55:12 +02:00
Nikita Popov
5dc995df37 Eliminate null return value for Normalizer::normalize()
One error condition was returning null instead of false. Adjust
the implementation to look the same way as the exact same check
a few lines below.
2021-07-14 11:43:22 +02:00
Nikita Popov
1c50784ae7 Deprecate IntlCalendar::roll() with bool argument
Pass 1 instead of true and -1 instead of false.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:34:51 +02:00
Máté Kocsis
65b96397b3
Declare tentative return types for ext/intl (#6986) 2021-07-06 10:55:43 +02:00
Christoph M. Becker
097cae9d90
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #74264: grapheme_strrpos() broken for negative offsets
2021-07-05 18:21:29 +02:00
Christoph M. Becker
8071bd2faf
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #74264: grapheme_strrpos() broken for negative offsets
2021-07-05 18:15:24 +02:00
Christoph M. Becker
28c9376306
Fix #74264: grapheme_strrpos() broken for negative offsets
We must not assume that `usearch_last()` gives the proper result for
negative offsets.  Instead we'd need to continue to search backwards
(`usearch_previous`) until we find a proper match.  However, apparently
searching backwards is broken, so we work around by searching forward
from the start of the string until we pass the `offset_pos`, and then
use the previous result.

Closes GH-7189.
2021-07-05 18:11:30 +02:00
Patrick Allaert
ac18dd0dc7 Prefer EXPECT over EXPECTF 2021-06-29 17:13:02 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Christoph M. Becker
1ae34385e1
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #68471: IntlDateFormatter fails for "GMT+00:00" timezone
2021-06-28 13:57:31 +02:00
Christoph M. Becker
1bf2b04b26
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #68471: IntlDateFormatter fails for "GMT+00:00" timezone
2021-06-28 13:55:56 +02:00
Christoph M. Becker
1a01f7816c
Fix #68471: IntlDateFormatter fails for "GMT+00:00" timezone
GMT+00:00 is recognized by ICU, and is normalized to GMT.  There are no
issues when GMT+00:00 is passed to `IntlTimeZone::createTimeZone()`,
but passing it to IntlDateFormatter::__construct() causes a failure,
since there is an additional check regarding the validity.  While
checking the validity of the result of `TimeZone::createTimeZone()`[1]
is a good idea, comparing the IDs is overly restrictive.  Instead we
just check that the timezone is supported by ICU.

[1] <https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/classicu_1_1TimeZone.html#a35da0507b62754ffe5d8d59c19775cdb>

Closes GH-7190.
2021-06-28 13:54:22 +02:00
Christoph M. Becker
46a6d481d3
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #72809: Locale::lookup() wrong result with canonicalize option
2021-06-16 10:38:14 +02:00
Christoph M. Becker
13f3999a77
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #72809: Locale::lookup() wrong result with canonicalize option
2021-06-16 10:36:51 +02:00
Christoph M. Becker
0f1b17e378
Fix #72809: Locale::lookup() wrong result with canonicalize option
Canonicalization converts the locale to ICU format[1].  However, the
lookup described in RFC 4647, section 3.4, is about POSIX format.  To
make that lookup work for ICU format, we also need to cater to keyword
separators.

The results are somewhat unexpected, but apparently canonical lookup is
explicitly supposed to return canonical language tags[2].

[1] <https://unicode-org.github.io/icu/userguide/locale/#canonicalization>
[2] <https://github.com/php/php-src/blob/php-7.4.20/ext/intl/locale/locale_methods.c#L1504>

Closes GH-7151.
2021-06-16 10:33:59 +02:00
Nikita Popov
1eaaabca2b Move test from intl to iconv
Somehow this iconv-specific test ended up in ext/intl instead.
2021-06-14 15:03:46 +02:00
Nikita Popov
6600ad6067 Add some missing EXTENSIONS sections to misc tests 2021-06-14 14:52:44 +02:00
Nikita Popov
39131219e8
Migrate more SKIPIF -> EXTENSIONS (#7139)
This is a mix of more automated and manual migration. It should remove all applicable extension_loaded() checks outside of skipif.inc files.
2021-06-11 12:58:44 +02:00
Nikita Popov
7485978339
Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00
deltragon
ae9f6e7a8f
Add IntlDatePatternGenerator (#6771)
Add IntlDatePatternGenerator class per RFC https://wiki.php.net/rfc/intldatetimepatterngenerator.
2021-06-10 12:36:38 +02:00
Nikita Popov
5c5727a57b Avoid make_printable_zval() in intl collator
Use zval_get_string() instead. This code is a real mess though,
and could use some more thorough cleanup.
2021-06-10 10:12:47 +02:00
Nikita Popov
e79a8c05ad Convert UConverter dtor_obj to free_obj
An unusal case where free_obj was not specified at all, and only
dtor_obj was used. Use the right handler.
2021-06-09 11:59:51 +02:00
Nikita Popov
cdbf3fdcdd Remove redundant dtor_obj handlers in intl
Both of these just forward to the default implementation, so
just use that directly. This is simpler and benefits from the
special-casing of the default implementation.
2021-06-09 11:47:37 +02:00
Nikita Popov
9d2a466c4b Remove explicit assignments of zend_objects_destroy_object
This is the default handler, no need to set it explicitly. This
makes it easier to see which objects really have a custom dtor_obj.
2021-06-09 11:29:50 +02:00
George Peter Banyard
b6958bb847
Implement "Deprecate implicit non-integer-compatible float to int conversions" RFC. (#6661)
RFC: https://wiki.php.net/rfc/implicit-float-int-deprecate

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-05-31 15:48:45 +01:00
Nikita Popov
9f263411eb XFAIL two intl tests on FreeBSD
These tests fail with the following diff:

========DIFF========
     date:  Tuesday, July 7, 2009 8:41:13 PM EDT
002+ msgf:  Wednesday, July 8, 2009 12:41:13 AM utc
002- msgf:  Tuesday, July 7, 2009 8:41:13 PM usnyc
========DONE========
FAIL Bug #58756: w.r.t MessageFormatter [ext/intl/tests/bug58756_MessageFormatter_variant2.phpt]

========DIFF========
001+ quinta-feira, 17 de maio de 2012 4:35:36 da tarde utc
001- quinta-feira, 17 de maio de 2012 5:35:36 da tarde ptlis
========DONE========
FAIL MessageFormat accepts IntlCalendar args [ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt]

That is, it appears that the timezone does not get applied. I don't
know why this happens, and don't want to spend more time trying to
figure this out.
2021-05-21 10:36:33 +02:00
Nikita Popov
7742f31f32 Disable workaround for ICU bug on newer versions
This is issue https://unicode-org.atlassian.net/browse/ICU-12584,
which has been fixed in ICU 64.1 by
a9d2196913.

I'm disabling the workaround for ICU >= 65, as we don't seem to be
doing minor version checks in intl.
2021-05-20 10:10:27 +02:00
Nikita Popov
680d198d50 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #81019
2021-05-17 16:33:44 +02:00
Nikita Popov
0bff67c0ab Fixed bug #81019
Before the zval -> zend_object migration, this code used macros
like FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK, which internally
clear the error. Now that they are no longer used, we need to
manually clear the error.
2021-05-17 16:33:35 +02:00
Matteo Beccati
9939b2b71f
Fix test on non-UTC setups 2021-05-17 09:24:49 +02:00
George Peter Banyard
e90180d06a
Use standard function signature instead of K&R in Intrl extension
Drive-by removal of register qualifier.

Fix [-Wstrict-prototypes] warnings in Intl extension.
2021-05-12 18:54:55 +01:00
Máté Kocsis
4ece535f19
Merge branch 'PHP-8.0'
* Fix return type of php_user_filter::onCreate()
* Fix return type of mysqli::init()
* Fix return type of UConverter::fromUCallback() and UConverter::toUCallback()
2021-05-07 15:23:28 +02:00
Máté Kocsis
54e2ef0b81
Fix return type of UConverter::fromUCallback() and UConverter::toUCallback()
Closes GH-6950
2021-05-07 15:21:58 +02:00
Nikita Popov
26860c6b6a Fix -Wmaybe-uninitialized warning in intl uchar
This variable can indeed be uninitialized when passed to convert_cp,
though it will not actually be used if uninitialized. This is
still UB though, so let's fix it.
2021-05-07 12:20:16 +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
Nikita Popov
331eddadc8 Make date/time type arguments of IntlDateFormatter ctor optional
Default them to IntlDateFormatter:FULL, which has value 0, which
was what you would get if you passed null to these arguments in
weak typing mode. The documentation called this ICU's default
date/time type.
2021-04-27 23:58:38 +02:00
Nikita Popov
b8942b8313 Fix test for older ICU versions
Apply the change that was done for variant7 to the other variants
as well.
2021-04-15 15:20:17 +02:00
Christoph M. Becker
b074e3b52b Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80763: msgfmt_format() does not accept DateTime references
2021-02-17 17:31:47 +01:00
Christoph M. Becker
553a0c52b1 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80763: msgfmt_format() does not accept DateTime references
2021-02-17 17:30:47 +01:00
Christoph M. Becker
84b6152842 Fix #80763: msgfmt_format() does not accept DateTime references
`intl_zval_to_millis()` needs to cater to references.

Closes GH-6707.
2021-02-17 17:26:48 +01:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00