Commit Graph

36 Commits

Author SHA1 Message Date
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Stanislav Malyshev
82f3d36583 cleanup intl types 2014-12-29 14:06:12 -08:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Johannes Schlüter
d0cb715373 s/PHP 5/PHP 7/ 2014-09-19 18:33:14 +02:00
Anatol Belski
af59e92b24 master renames phase 7 2014-08-25 21:51:49 +02:00
Anatol Belski
4d997f63d9 master renames phase 3 2014-08-25 20:22:49 +02:00
Anatol Belski
c3e3c98ec6 master renames phase 1 2014-08-25 19:24:55 +02:00
Anatol Belski
888ef26cc5 yet trivial fixes 2014-08-20 22:54:00 +02:00
Anatol Belski
063079b62e ported ext/intl, bugfixes to go 2014-08-19 22:57:17 +02:00
Anatol Belski
63d3f0b844 basic macro replacements, all at once 2014-08-19 08:07:31 +02:00
Dmitry Stogov
42c4bcaed1 Fixed ZTS build 2014-07-14 14:25:04 +04:00
Dmitry Stogov
424894de02 Fixed compilation problems 2014-06-30 18:08:16 +04:00
Xinchen Hui
f466be5e9b Fixed memory leak 2014-06-29 19:46:01 +08:00
Xinchen Hui
a1426c62d5 Fixed initialize of zval 2014-06-28 21:05:20 +08:00
Xinchen Hui
b6e9c76d67 Refactoring ext/intl (only compilerable now, far to finish :<) 2014-06-28 12:20:35 +08:00
Xinchen Hui
4fbaddb4f8 Refactoring ext/intl (incompleted) 2014-06-28 00:02:50 +08:00
Stanislav Malyshev
219a682e8e fix possibility of access to *storedType without initialization 2013-10-20 23:04:38 -07:00
Christopher Jones
d5979c88ea Reduce (some more) compile noise of 'unused variable' and 'may be used
uninitialized' warnings.
2013-08-19 17:17:54 -07: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
9762609cec Remove executable bit from files 2012-07-30 10:25:17 +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
2416719fb1 Unified zval -> UDate conversions
Now IntlDateFormatter::format() also accepts IntlCalendar objects.
Code is shared in MessageFormatter and IntlDateFormatter.
2012-07-02 00:24:54 +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
ec23c3e540 MessageFormatter accepts IntlCalendar arguments
Now MessageFormatter::format() accepts IntlCalendar objects to be used in
arguments of type Format::kDate.
2012-05-17 17:57:37 +02:00
Gustavo André dos Santos Lopes
e9351b89a9 Bug #58756: w.r.t MessageFormatter (partial fix)
I don't think the current ICU API allows this bug to be completely fixed.

Right now, the code cannot control the time zone used in date/time formats
that appear inside complex subformats. See the comment inside
umsg_set_timezone().
2012-05-17 17:57:01 +02:00
Gustavo André dos Santos Lopes
ac33e40d2a Keep date precision in MessageFormatter.
MessageFormatter::parse and MessageFormat::format (and their static
equivalents) now don't throw away better than second precision in the
arguments.

It's already bad enough that in MessageFormatter and IntlDateFormatter we
use seconds since epoch instead of milliseconds since epoch, deviating
from the ICU date representations. But we don't need to throw away extra
precision when parsing dates; we can keep the seconds since epoch
convention and return non integer doubles with only a small BC impact.
Note that we already could return doubles from MessageFormatter::parse if
the date was sufficiently in the past or in the future.
2012-05-13 23:03:07 +02:00
Gustavo André dos Santos Lopes
53860672f3 ICU < 4.8 compat in MessageFormatter
Restricted support for named arguments to ICU 4.8+.

Also added bound checks when converting arguments to Formattables.
2012-05-13 20:55:02 +01:00
Gustavo André dos Santos Lopes
1c4f99b988 Better error messages in MessageFormatter::format. 2012-05-13 20:53:06 +01:00
Gustavo André dos Santos Lopes
0ad1b14f16 Accept numeric strings for dates.
Refactored umsg_helper_zval_to_millis in the process.
2012-05-13 20:53:06 +01:00
Gustavo André dos Santos Lopes
20dd5ccf19 Cache arguments type info in MessageFormatter. 2012-05-13 20:53:05 +01:00
Gustavo André dos Santos Lopes
407455876e Set global error if insufficient numeric args. WS. 2012-05-13 20:53:05 +01:00
Gustavo André dos Santos Lopes
edca0e2adb Refactoring of patch for FR #61871. 2012-05-13 20:52:41 +01:00
Gustavo André dos Santos Lopes
c9b913b56b Orig patch for FR #61871 by David Sklar 2012-05-13 20:51:43 +01:00
Gustavo André dos Santos Lopes
95fbae891a Compatibility with old versions of ICU (4.0+). 2012-04-01 23:28:01 +01:00
Ed Batutis
8e0529e0d1 Fix for pecl bug 14664 - problem with older gcc 2008-10-16 18:06:05 +00:00
Stanislav Malyshev
0d16b1516b Merge intl extension into core 2008-07-07 22:51:04 +00:00