Commit Graph

82 Commits

Author SHA1 Message Date
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01: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
Peter Kokot
b1767d8a56 Bump intl extension version to PHP release version
This patch syncs and simplifies the intl core extension versioning
to match the PHP release version.
2018-06-14 23:35:29 +02:00
Anatol Belski
14de058086 Rethink conditions
Raise the requirement to ICU 56. Mixing both old and new normalizer APIs
would create too much complexity. Therefore go by the recommended ICU
version where all the normalizer API became stable. For the older ICU,
the deprecated normalizer API is used.
2018-04-06 21:33:13 +02:00
Anatol Belski
13a5020f98 Check feature availability as ICU < 49 is still supported 2018-04-05 18:08:49 +02:00
Paul Crovella
b873d3c288
Add normalizer_get_raw_decomposition function
Implements #76111 https://bugs.php.net/bug.php?id=76111
2018-03-22 23:27:39 +01:00
Dmitry Stogov
9e709e2fa0 Move constants into read-only data segment 2017-12-14 18:43:44 +03:00
Anatol Belski
ff1b1c2761 Add TZ and Unicode versions to intl MINFO 2017-10-21 16:17:31 +02:00
Sara Golemon
80f4297c25 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Bugfix #74993 Wrong reflection param into for some intl: lookup_*() methods
2017-07-26 18:55:46 -04:00
Sara Golemon
c7aa8ba0ee
Bugfix #74993 Wrong reflection param into for some intl: lookup_*() methods 2017-07-26 18:55:23 -04:00
Remi Collet
90f33b1ac7 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  NEWS
  Fix bug #74705 for collator_get_sort_key
  Fixes bug #74705 Wrong ReflectionInfo for Collator::getSortKey()
2017-06-13 08:50:10 +02:00
Remi Collet
78970d5338 Fix bug #74705 for collator_get_sort_key 2017-06-13 08:48:17 +02:00
Joe Watkins
2735318c7b
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #74468 wrong reflection on Collator::sortWithSortKeys
2017-05-02 06:21:54 +01:00
Fabien Villepinte
f50df1d0e3
Fix bug #74468 wrong reflection on Collator::sortWithSortKeys 2017-05-02 06:20:40 +01:00
Anatol Belski
35bbcd17a9 remove unused declarations 2016-06-23 15:02:43 +02:00
Nikita Popov
1ac152938c Move semicolon into TSRMLS_CACHE_EXTERN/DEFINE
Also re bug #71575.
2016-03-03 16:50:01 +01:00
Nikita Popov
cf0ffa8e4c Remove datefmt_set_timezone_id and OO variant 2015-04-01 12:34:28 +02:00
Anatol Belski
2d78023244 cleanup the mod version macros, round 2 2015-03-23 20:33:54 +01:00
Anatol Belski
af3ca74501 made ZEND_TSRMLS_CACHE_* macros look like function calls
which also comply with the current semantics for such macros
2015-02-16 17:19:32 +01:00
Sara Golemon
ebb60ac7dd Add IntlChar class to intl extension
Exposes ICU's uchar functionality as a set of static methods
2015-01-16 14:37:44 -08:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Anatol Belski
4fce2ae2c6 opcache, intl, gmp, exif, com, bcmath to use static tsrmls 2014-10-17 15:51:21 +02: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
Dmitry Stogov
bce6a36c8a Merge branch 'master' into test
* master: (48 commits)
  change locale - looks like not everybody has sl_SI
  Fix bug #66921 - Wrong argument type hint for function intltz_from_date_time_zone
  fix format
  Fix bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting)
  Make sure the generator script also creates a newline at the end of file
  Add newline at end of file to prevent compilation warning
  Fix handling of session user module custom handlers.
  Reference bug report instead of github issue in NEWS file
  add more exts for Travis
  Update NEWS
  Fix phpdbg.1 man page installation when build != src directory
  BFN for bug #67551 (php://input temp file will be located in sys_temp_dir instead of upload_tmp_dir)
  reorder
  restore API compatibility
  finish
  refactor php_stream_temp_create{,_ex} and use it for the php://input stream
  refactor _php_stream_fopen_{temporary_,tmp}file()
  fix length overflow of HTTP_RAW_POST_DATA
  Update NEWS
  Fixed bug #67215 (php-cgi work with opcache, may be segmentation fault happen)
  ...

Conflicts:
	ext/opcache/zend_accelerator_util_funcs.c
	ext/session/mod_user.c
	ext/spl/spl_array.c
	ext/spl/spl_dllist.c
	ext/standard/file.c
	ext/standard/streamsfuncs.c
	ext/standard/string.c
	main/streams/memory.c
2014-07-07 19:21:23 +04:00
Stanislav Malyshev
8ba240a70b Fix bug #66921 - Wrong argument type hint for function intltz_from_date_time_zone 2014-07-07 00:48:44 -07:00
Xinchen Hui
e4e9e80067 Fixed segfault while starting up 2014-06-28 20:14:12 +08:00
Xinchen Hui
b6e9c76d67 Refactoring ext/intl (only compilerable now, far to finish :<) 2014-06-28 12:20:35 +08:00
Gustavo André dos Santos Lopes
a4538a4ca2 intl: add intlcal_set_minimal_days_in_first_week()
and IntlCalendar::setMinimalDaysInFirstWeek(). This one had slipped.
we had a ::getMinimalDaysInFirstWeek() but no way to change the value.
2013-07-03 05:06:32 +01:00
Sara Golemon
1faddd15d9 Add UConverter class (ICU's UConverter API)
RFC at http://wiki.php.net/rfc/uconverter
2013-01-29 19:05:14 +01:00
Gustavo Lopes
befe4ab479 Merge branch 'PHP-5.4'
* PHP-5.4:
  Fixed defective cloning in ext/intl classes
  NEWS for commit 72c807a
  Allow Spoofchecker to be registered on ICU 49.1
  Announce on NEWS change in 1ce572c
2012-08-26 23:42:57 +02:00
Gustavo Lopes
72c807ad67 Allow Spoofchecker to be registered on ICU 49.1 2012-08-26 23:39:04 +02:00
Gustavo André dos Santos Lopes
06e06f026d Merge branch '5.4'
* 5.4:
  Fix test title and limit it to ICU >= 4.8
  Remove executable bit from files
  Limit test to ICU 49
  Remove executable bit from files
2012-07-30 11:04:48 +02:00
Gustavo André dos Santos Lopes
dec7bad635 Merge branch '5.3' into 5.4
* 5.3:
  Limit test to ICU 49
  Remove executable bit from files
2012-07-30 10:31:10 +02:00
Gustavo André dos Santos Lopes
9762609cec Remove executable bit from files 2012-07-30 10:25:17 +02:00
Gustavo André dos Santos Lopes
f356be68c2 ini intl.explicit_cleanup -> INTL_EXPLICIT_CLEANUP
Added an environment variable and removed the ini setting
intl.explicit_cleanup for calling u_cleanup()
2012-07-24 15:13:02 +02:00
Gustavo Lopes
c052b9c99a Do not fetch default locale once on minit or rinit
The default locale is now requested to ICU when it's needed by using
intl_get_default_locale().
2012-07-23 16:38:27 +02:00
Gustavo Lopes
0dfcc3e798 Add ini setting intl.explicit_cleanup
This is to help with looking for leaks. If set to true, this ini
setting forces a call to u_cleanup() on module shutdown.
2012-07-23 16:36:24 +02:00
Gustavo André dos Santos Lopes
99e48d3a57 Merge branch 'datefmt_tz_cal_interop'
* datefmt_tz_cal_interop:
  Readded accidentally removed line
  Added IntlDateFormatter::formatObject(). Refactor
  Refactored internal_get_timestamp()
  Unified zval -> UDate conversions
2012-07-22 04:22:48 +02:00
Gustavo André dos Santos Lopes
2f0775b999 Added IntlDateFormatter::formatObject(). Refactor
To better support IntlCalendar, added this function:

string IntlDateFormatter::formatObject(IntlCalendar|DateTime $obj [,
	array|int|string $format = null [, string $locale = null).

$format is either of the constants IntlDateFormatter::FULL, etc., in
which case this format applies to both the date and the time, an array
in the form array($dateFormat, $timeFormat), or a string with the
SimpleDateFormat pattern.

This uses both the Calendar type and the timezone of the passed object
to configure the formatter (a GregorianCalendar is forced for
DateTime).

Some stuff was moved around and slighlt modified to allow for more code
reuse.
2012-07-22 04:22:23 +02:00
Gustavo André dos Santos Lopes
75964450ed Merge branch 'break_iterator'
* break_iterator:
  Fix typo in error message
  BreakIterator: fix compat with old ICU versions
  Fix build error one ext/intl
  BreakIterator::getPartsIterator: new optional arg
  Added IntlCodePointBreakIterator.
  Add Intl prefix to BreakIterator/RuleBasedBI
  Remove trailing space
  Replaced zend_parse_method_params with plain zpp
  BreakIter: Removed getAvailableLocales/getHashCode
  Change in BreakIterator::getPartsIterator()
  BreakIterator: add rules status constants
  Tests for (RuleBased)BreakIterator.
  BreakIterator and RuleBasedBreakiterator added
2012-06-25 12:11:49 +02:00
Gustavo André dos Santos Lopes
9c5074a484 Fix undeclared intl_locale_get_default()
This was causing segfaults at least in the resourcebundle
constructor.

Also moved intl_locale_get_default() to a more central location
and fixed a constness warning in resourcebundle_ctor().
2012-06-25 10:59:58 +02:00
Gustavo André dos Santos Lopes
4ec75539db Change in BreakIterator::getPartsIterator()
BreakIterator::getPartsIterator() now returns an IntlIterator subclass
with a special method, getBreakIterator(), that returns the
associated BreakIterator.

Any call to getRuleStatus() is forwarded to the BreakIterator.
2012-06-10 00:04:53 +02:00
Gustavo André dos Santos Lopes
f5b421621d BreakIterator and RuleBasedBreakiterator added
This commit adds wrappers for the classes BreakIterator and
RuleBasedbreakIterator. The C++ ICU classes are described here:
<http://icu-project.org/apiref/icu4c/classBreakIterator.html>
<http://icu-project.org/apiref/icu4c/classRuleBasedBreakIterator.html>

Additionally, a tutorial is available at:
<http://userguide.icu-project.org/boundaryanalysis>

This implementation wraps UTF-8 text in a UText. The text is
iterated without any copying or conversion to UTF-16. There is
also no validation that the input is actually UTF-8; where there
are malformed sequences, the UText will simply U+FFFD.

The class BreakIterator cannot be instantiated directly (has a
private constructor). It provides the interface exposed by the ICU
abstract class with the same name. The PHP class is not abstract
because we may use it to wrap native subclasses of BreakIterator
that we don't know how to wrap. This class includes methods to
move the iterator position to the beginning (first()), to the
end (last()), forward (next()), backwards (previous()), to the
boundary preceding a certain position (preceding()) and following
a certain position (following()) and to obtain the current position
(current()). next() can also be used to advance or recede an
arbitrary number of positions.

BreakIterator also exposes other native methods:
getAvailableLocales(), getLocale() and factory methods to build
several predefined types of BreakIterators: createWordInstance()
for word boundaries, createCharacterInstance() for locale
dependent notions of "characters", createSentenceInstance() for
sentences, createLineInstance() and createTitleInstance() -- for
title casing breaks. These factories currently return
RuleBasedbreakIterators where the names of the rule sets are found
in the ICU data, observing the passed locale (although the locale
is taken into considering there are very few exceptions to the
root rules).

The clone and compare_object PHP object handlers are also
implemented, though the comparison does not yield meaningful results
when used with >, <, >= and <=.

Note that BreakIterator is an iterator only in the sense of the
first 'Iterator' in 'IteratorIterator', i.e., it does not
implement the Iterator interface. The reason is that there is
no sensible implementation for Iterator::key(). Using it for
an ordinal of the current boundary is not feasible because
we are allowed to move to any boundary at any time. It we were
to determine the current ordinal when last() is called we'd
have to traverse the whole input text to find out how many
breaks there were before. Therefore, BreakIterator implements
only Traversable. It can be wrapped in an IteratorIterator,
but the usual warnings apply.

Finally, I added a convenience method to BreakIterator:
getPartsIterator(). This provides an IntlIterator, backed
by the BreakIterator PHP object (i.e. moving the pointer or
changing the text in BreakIterator affects the iterator
and also moving the iterator affects the backing BreakIterator),
which allows traversing the text between each boundary.
This iterator uses the original text to retrieve the text
between two positions, not the code points returned by the
wrapping UText. Therefore, if the text includes invalid code
unit sequences, these invalid sequences will be in the output
of this iterator, not U+FFFD code points.

The class RuleBasedIterator exposes a constructor that allows
building an iterator from arbitrary compiled or non-compiled
rules. The form of these rules in described in the tutorial linked
above. The rest of the methods allow retrieving the rules --
getRules() and getCompiledRules() --, a hash code of the rule set
(hashCode()) and the rules statuses (getRuleStatus() and
getRuleStatusVec()).

Because the RuleBasedBreakIterator constructor may return parse
errors, I reuse the UParseError to text function that was in the
transliterator files. Therefore, I move that function to
intl_error.c.

common_enum.cpp was also changed, mainly to expose previously
static functions. This avoided code duplication when implementing
the BreakIterator iterator and the IntlIterator returned by
BreakIterator::getPartsIterator().
2012-06-04 22:25:07 +02:00
Gustavo André dos Santos Lopes
eb346ef0f4 DateFormat plays nice with Calendar, TimeZone
The following changes were made:

* The IntlDateFormatter constructor now accepts the usual values
  for its $timezone argument. This includes timezone identifiers,
  IntlTimeZone objects, DateTimeZone objects and NULL. An empty
  string is not accepted. An invalid time zone is no longer accepted
  (it used to use UTC in this case).
* When NULL is passed to IntlDateFormatter, the time zone specified in
  date.timezone is used instead of the ICU default.
* The IntlDateFormatter $calendar argument now accepts also an
  IntlCalendar. In this case, IntlDateFormatter::getCalendar() will
  return false.
* The time zone passed to the IntlDateFormatter is ignored if it is
  NULL and if the calendar passed is an IntlCalendar object -- in this
  case, the IntlCalendar time zone will be used instead. Otherwise,
  the time zone specified in the $timezone argument is used instead.
* Added IntlDateFormatter::getCalendarObject(), which always returns
  the IntlCalendar object that backs the DateFormat, even if a
  constant was passed to the constructor, i.e., if an IntlCalendar
  was not passed to the constructor.
* Added IntlDateFormatter::setTimeZone(). It accepts the usual values
  for time zone arguments. If NULL is passed, the time zone of the
  IntlDateFormatter WILL be overridden with the default time zone,
  even if an IntlCalendar object was passed to the constructor.
* Added IntlDateFormatter::getTimeZone(), which returns the time zone
  that's associated with the DateFormat.
* Depreacated IntlDateFormatter::setTimeZoneId() and made it an alias
  for IntlDateFormatter::setTimeZone(), as the new ::setTimeZone()
  also accepts plain identifiers, besides other types.
  IntlDateFormatter::getTimeZoneId() is not deprecated however.
* IntlDateFormatter::setCalendar() with a constant passed should now
  work correctly. This requires saving the requested locale to the
  constructor.
* Centralized the hacks required to avoid compilation disasters on
  Windows due to some headers being included inside and outside of
  extern "C" blocks.
2012-06-04 00:01:48 +02:00
Gustavo André dos Santos Lopes
3a81f90ebc Added IntlCalendar::toDateTime() 2012-05-17 23:18:51 +02:00
Gustavo André dos Santos Lopes
4cfd9995da Added IntlTimeZone::fromDateTimeZone() and ::toDateTimeZone.
IntlTimeZone::fromDateTimeZone(DateTimeZone $dtz) converts from an
ext/date TimeZone to an IntlTimeZone. The conversion is done by feeding
the time zone name (essentially what would be given by
DateTimeZone::getName()) to ICU's TimeZone::createTimeZone except if it's
an offset time zone. In that case, the offset is read from the ext/date
time zone object structure and an appopriate id (of the form
GMT<+|-><HH:MM>) is given to ICU's TimeZone::createTimeZone. Not all
ext/date time zones are recognized for ICU. For instance, WEST is not.
Note that these kind of abbreviations, as far as I can tell, can only be
created via ext/date DateTime, not directly through DateTimeZone's
constructor.

For IntlTimeZone::toDateTimeZone(), the behavior is symmetrical.
We instantiate a DateTimeZone and then call its constructor if we don't
have an offset time zone, otherwise we mess with its structure. If the
timezone is not valid for ext/date, then we allow the exception of
DateTimeZone constructor to propagate.
2012-05-17 17:23:51 +02:00
Gustavo André dos Santos Lopes
81278e1bbb Added IntlCalendar::fromDateTime()
IntlCalendar::fromDateTime(DateTime|string $dateTime[, string $locale)
intlcal_from_date_time(...)

If a string is given as the first argument, the method will try to
instantiate a new DateTime object and use that instead.
2012-05-17 17:23:47 +02:00