Commit Graph

1384 Commits

Author SHA1 Message Date
Kamil Tekiela
c3dda473cc
Fix 'can not' in test data and in code comments 2021-10-05 09:51:58 +01:00
Nikita Popov
6e1d9f6a09 Don't rely on HT internals in datefmt_format_object
Use ZEND_HASH_FOREACH_VAL instead.
2021-09-30 11:48:01 +02:00
Nikita Popov
0eb5c1a018 Update test expectation
The new output is correct, though the fix here was rather accidental.
We still need a proper fix for bug #78308 on earlier branches, but
for now update the test to make the build green again.
2021-09-24 16:02:43 +02:00
Tim Starling
c96be7b8f2 Use ASCII lower case for misc case folding
Use ASCII case conversion instead of locale-dependent case conversion in
the following places:

* grapheme_stripos() and grapheme_strripos() in the "fast" path
* ldap_get_entries()
* oci_pconnect() for case folding of parameters when constructing a key
  into the connection or session pool
* SoapClient: case folding of function names
* get_meta_tags(): case conversion of property names
* http stream wrapper: header names
* phpinfo(): anchor names
* php_verror(): docref URLs
* rfc1867.c: Content-Type boundary parameter name
* streams.c: stream protocol names

Using locale-dependent case folding for these cases is either
unnecessary or actively incorrect. These functions could have
misbehaved when used with certain locales (e.g. Turkish).

Closes GH-7511.
2021-09-24 09:20:08 +02:00
Nikita Popov
4fcca032e1 Make IntlCalendar::roll() return type tentative
This method did not have a type in PHP 8.0 and is not final, so
the new return type should be tentative.
2021-09-22 15:00:29 +02:00
Nikita Popov
410bdaba3f Fix compiler warnings in ext/intl
I don't really get why these didn't show up before.
2021-09-16 11:18:38 +02:00
Nikita Popov
d5ee081cfd Add missing field initializer
To fix -Wmissing-field-initializers warning.
2021-09-16 10:42:52 +02:00
Máté Kocsis
d670d9335c
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix default value of $flags in idn_to_ascii() and idn_to_utf8()
2021-09-04 17:57:23 +02:00
Máté Kocsis
d5aed7b0e3
Fix default value of $flags in idn_to_ascii() and idn_to_utf8() 2021-09-04 16:42:28 +02:00
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