Commit Graph

52 Commits

Author SHA1 Message Date
Xinchen Hui
4a643e5e13 Fixed bug #72639 (Segfault when instantiating class that extends IntlCalendar and adds a property) 2016-07-21 14:25:15 +08:00
Joe Watkins
028485ae69 fix calendar segfault 2016-04-11 08:03:15 +01:00
Nikita Popov
0a3c1fb4c2 More zpp cleanup in ext/intl 2015-10-06 22:58:02 +02:00
Nikita Popov
1287c48082 Fix/improve zpp usage
The ext/interbase changes are done blindly, fingers crossed.

Some of these are bug fixes, some make zpp usage more idiomatic.
2015-10-02 09:35:00 +02:00
Dmitry Stogov
4a2e40bb86 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 04:05:24 +03:00
Dmitry Stogov
e96616739c Fixed redundand internal constructor behavior (they shouldn't return NULL anymore) 2015-05-07 10:38:47 +03:00
Nikita Popov
4e2be45309 Fix leak in IntlCalendar::fromDateTime() 2015-04-17 09:28:36 +02:00
Nikita Popov
122d759618 Always throw TypeException on throwing zpp failures
Introduces a ZEND_PARSE_PARAMS_THROW flag for zpp, which forces to
report FAILURE errors using a TypeException instead of a Warning,
like it would happen in strict mode.

Adds a zend_parse_parameters_throw() convenience function, which
invokes zpp with this flag.

Converts all cases I could identify, where we currently have
throwing zpp usage in constructors and replaces them with this API.
Error handling is still replaced to EH_THROW in some cases to handle
other, domain-specific errors in constructors.
2015-04-06 11:27:34 +02:00
Dmitry Stogov
1018f462d8 Patch improvement:
Removed the corresponding core code.
Fixed ext/com_dotnet and ext/date.
Refactored ext/intl changes.
Improved ext/fileinfo and ext/pdo changes.
Fixed tests.
2015-03-30 18:53:38 +03:00
Dmitry Stogov
9155a267ad Merge branch 'InternalClassClean' of github.com:Danack/php-src into InternalClassClean
* 'InternalClassClean' of github.com:Danack/php-src:
  Fixed indentation. Fixed comment style. Fixed commented out code.
  Reverted change to function name and added note of why it is different from the class it is actually changing.
  Made UConverter throw an exception if the constructor fails.
  Fixed PDO constructor to not return null.
  Fixed fileinfo behaviour.
  Made Phar throw exception on bad constructor.
  Converted intl extension to use IntlException in constructors.
  Fixed SplFixedArray and tests.
  Fixed ReflectionExtension and ReflectionProperty.
  Fixed ReflectionFunction, ReflectionMethod and ReflectionParameter.
  Fixed PDORow behaviour and message.
2015-03-30 12:14:43 +03:00
Danack
99dae96dc0 Converted intl extension to use IntlException in constructors. 2015-03-15 13:59:48 +00:00
Dmitry Stogov
816b196973 Fixed memory leak 2015-03-10 23:16:09 +03:00
Anatol Belski
d2f64edf29 remove unused var 2015-01-30 10:31:37 +01:00
Dmitry Stogov
8aa146b810 Fixed use after free 2015-01-26 12:24:33 +03: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
Johannes Schlüter
d0cb715373 s/PHP 5/PHP 7/ 2014-09-19 18:33:14 +02:00
Anatol Belski
3234480827 first show to make 's' work with size_t 2014-08-27 20:49:31 +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
1dd07d6bf4 Partial fix that allows internal constructors to set $this to null.
The address of $this passed to drectly called internal constructor in execute_data->return_value.
Internal constructors should use ZEND_CTOR_MAKE_NULL() macro (insted of previous ZEND_NULL(EG(This))) to do the work.

This patch doesn't fix the problem for indirectly called constructors. e.g. parant::__construct().
2014-07-09 11:57:42 +04:00
Dmitry Stogov
3c4e64d633 Fixed IntlCalendar::toDateTime() 2014-07-08 17:28:09 +04:00
Xinchen Hui
499293449b Fixed segfault in intlgregcal_create_instance 2014-06-29 22:56:27 +08:00
Xinchen Hui
a94ec141fe Fixed retval with zend_call_method 2014-06-29 19:07:06 +08:00
Xinchen Hui
e1437022e1 Fixed segfault, segfault and segfault 2014-06-29 00:29:07 +08:00
Xinchen Hui
1d79334806 Fixed get_debug_info 2014-06-28 23:30:46 +08:00
Xinchen Hui
5614467c6b Fixed Calendar_objects_free 2014-06-28 20:58:50 +08:00
Xinchen Hui
b53bc5c762 Fixed segfaults 2014-06-28 20:52:41 +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
Dmitry Stogov
050d7e38ad Cleanup (1-st round) 2014-04-15 15:40:40 +04:00
Dmitry Stogov
f4cfaf36e2 Use better data structures (incomplete) 2014-02-10 10:04:30 +04: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
9487f0b4bb intl: fix extra space in constant name 2013-07-03 05:15:56 +01: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
Gustavo Lopes
ee6522bebf Write local err on intlcal_get_time_zone() failure 2013-01-29 19:06:14 +01: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
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
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
a1e97bada8 Fixed problem in IntlCalendar debug handler
*is_temp was not being set.

Also deleted a redundant assignment to *is_temp in IntlTimeZone.
2012-05-25 13:29:19 +02:00
Felipe Pena
82740ef31e - Fixed build using g++ (which complains about jump that crosses initialization) 2012-05-20 16:17:17 -03:00
Gustavo André dos Santos Lopes
3a81f90ebc Added IntlCalendar::toDateTime() 2012-05-17 23:18:51 +02:00
Gustavo André dos Santos Lopes
887744f6b4 Fixed bad DateTime construction state check 2012-05-17 18:16:54 +02:00
Gustavo André dos Santos Lopes
81d8f4079c Whitespace. 2012-05-17 17:23:52 +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
Gustavo André dos Santos Lopes
9a35d45a5b Accept DateTimeZone where time zones are expected.
Also unified timezone handling in IntlCalendar::setTimeZone()
to that in the IntlCalendar and IntlGregorianCalendar constructors.
2012-05-17 17:23:46 +02:00
Gustavo André dos Santos Lopes
95fbae891a Compatibility with old versions of ICU (4.0+). 2012-04-01 23:28:01 +01:00