Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

[Zend\I18n] php.ini setting "intl.use_exceptions" on true #6312

Closed
ThaDafinser opened this issue May 22, 2014 · 3 comments
Closed

[Zend\I18n] php.ini setting "intl.use_exceptions" on true #6312

ThaDafinser opened this issue May 22, 2014 · 3 comments
Assignees
Milestone

Comments

@ThaDafinser
Copy link
Contributor

When using intl.use_exceptions as true following validator will fail hard with the exception from the intl component:

  • DateTime
  • Float
  • Int

Possible solutions:

  • let it be like it is today (maybe this setting nobody used expect me?)
  • try/catch block in addition to the intl_is_failure() check
  • change php.ini setting always to false during validation and change it back after the check

Note: This feature was introduced with PHP 5.5
http://www.php.net/manual/en/class.intlexception.php

@Ocramius
Copy link
Member

@ThaDafinser I'd like to note that ZF2 does never change the environment. Changing ini settings is surely not an acceptable approach.

@DASPRiD
Copy link
Member

DASPRiD commented May 22, 2014

I'd vouch for the try-catch block approach (if anyone minds making a PR).

@Ocramius Ocramius added this to the 2.3.4 milestone Jan 3, 2015
@Ocramius Ocramius self-assigned this Jan 3, 2015
Ocramius pushed a commit that referenced this issue Jan 3, 2015
Since PHP 5.5.0, the configuration option 'intl.use_exceptions' is available.
When set to true, IntlException's are thrown instead of just setting a error
code, so no calls to intl_is_failure() are necessary.
Without the try/catch, the Int, Float and DateTime I18n validators hard-fail
in case 'intl.use_exceptions' is set to true.

NOTE: catching Exception (super class of IntlException), as IntlException is
not available prior to PHP 5.5.0.

refs #6312
Ocramius added a commit that referenced this issue Jan 3, 2015
@Ocramius
Copy link
Member

Ocramius commented Jan 3, 2015

Handled in #6598

gianarb pushed a commit to zendframework/zend-i18n that referenced this issue May 15, 2015
Since PHP 5.5.0, the configuration option 'intl.use_exceptions' is available.
When set to true, IntlException's are thrown instead of just setting a error
code, so no calls to intl_is_failure() are necessary.
Without the try/catch, the Int, Float and DateTime I18n validators hard-fail
in case 'intl.use_exceptions' is set to true.

NOTE: catching Exception (super class of IntlException), as IntlException is
not available prior to PHP 5.5.0.

refs zendframework/zendframework#6312
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants