Skip to content

Commit 69f67f9

Browse files
authored
1 parent 2bb98cd commit 69f67f9

File tree

6 files changed

+29
-5
lines changed

6 files changed

+29
-5
lines changed

ext/intl/php_intl.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,24 @@ const char *intl_locale_get_default( void )
9898
return INTL_G(default_locale);
9999
}
100100

101+
static PHP_INI_MH(OnUpdateErrorLevel)
102+
{
103+
zend_long *p = (zend_long *) ZEND_INI_GET_ADDR();
104+
*p = zend_ini_parse_quantity_warn(new_value, entry->name);
105+
if (*p) {
106+
php_error_docref("session.configuration", E_DEPRECATED,
107+
"Using a value different than 0 for intl.error_level is deprecated,"
108+
" as the intl.error_level INI setting is deprecated."
109+
" Instead the intl.use_exceptions INI setting should be enabled to throw exceptions on errors"
110+
" or intl_get_error_code()/intl_get_error_message() should be used to manually deal with errors");
111+
}
112+
return SUCCESS;
113+
}
114+
101115
/* {{{ INI Settings */
102116
PHP_INI_BEGIN()
103117
STD_PHP_INI_ENTRY(LOCALE_INI_NAME, NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_locale, zend_intl_globals, intl_globals)
104-
STD_PHP_INI_ENTRY("intl.error_level", "0", PHP_INI_ALL, OnUpdateLong, error_level, zend_intl_globals, intl_globals)
118+
STD_PHP_INI_ENTRY("intl.error_level", "0", PHP_INI_ALL, OnUpdateErrorLevel, error_level, zend_intl_globals, intl_globals)
105119
STD_PHP_INI_BOOLEAN("intl.use_exceptions", "0", PHP_INI_ALL, OnUpdateBool, use_exceptions, zend_intl_globals, intl_globals)
106120
PHP_INI_END()
107121
/* }}} */

ext/intl/tests/gh17469.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ try {
2828
}
2929
?>
3030
--EXPECTF--
31+
Deprecated: ini_set(): Using a value different than 0 for intl.error_level is deprecated, as the intl.error_level INI setting is deprecated. Instead the intl.use_exceptions INI setting should be enabled to throw exceptions on errors or intl_get_error_code()/intl_get_error_message() should be used to manually deal with errors in %s on line %d
3132

3233
Warning: UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR in %s on line %d
3334

34-
Warning: UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR in %s on line 5
35+
Warning: UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR in %s on line %d
3536
UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR
3637
UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR

ext/intl/tests/ini_use_exceptions_basic.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ var_dump($t->transliterate('a', 3));
1818
--EXPECTF--
1919
string(133) "Transliterator::transliterate(): Neither "start" nor the "end" arguments can exceed the number of UTF-16 code units (in this case, 1)"
2020

21+
Deprecated: ini_set(): Using a value different than 0 for intl.error_level is deprecated, as the intl.error_level INI setting is deprecated. Instead the intl.use_exceptions INI setting should be enabled to throw exceptions on errors or intl_get_error_code()/intl_get_error_message() should be used to manually deal with errors in %s on line %d
22+
2123
Notice: Transliterator::transliterate(): Neither "start" nor the "end" arguments can exceed the number of UTF-16 code units (in this case, 1) in %s on line %d
2224
bool(false)

ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ IntlTimeZone::createTimeZoneIDEnumeration(): variant without region
44
intl
55
--FILE--
66
<?php
7-
ini_set("intl.error_level", E_WARNING);
87
$enum = IntlTimeZone::createTimeZoneIDEnumeration(
98
IntlTimeZone::TYPE_ANY);
109
$countAny = count(iterator_to_array($enum));

php.ini-development

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,8 +1021,12 @@ cli_server.color = On
10211021
; This directive allows you to produce PHP errors when some error
10221022
; happens within intl functions. The value is the level of the error produced.
10231023
; Default is 0, which does not produce any errors.
1024+
; This directive is deprecated.
10241025
;intl.error_level = E_WARNING
1025-
;intl.use_exceptions = 0
1026+
; If enabled this directive indicates that when an error occurs within an
1027+
; intl function a IntlException should be thrown.
1028+
; Default is Off, which means errors need to be handled manually.
1029+
;intl.use_exceptions = On
10261030

10271031
[sqlite3]
10281032
; Directory pointing to SQLite3 extensions

php.ini-production

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,12 @@ cli_server.color = On
10231023
; This directive allows you to produce PHP errors when some error
10241024
; happens within intl functions. The value is the level of the error produced.
10251025
; Default is 0, which does not produce any errors.
1026+
; This directive is deprecated.
10261027
;intl.error_level = E_WARNING
1027-
;intl.use_exceptions = 0
1028+
; If enabled this directive indicates that when an error occurs within an
1029+
; intl function a IntlException should be thrown.
1030+
; Default is Off, which means errors need to be handled manually.
1031+
;intl.use_exceptions = On
10281032

10291033
[sqlite3]
10301034
; Directory pointing to SQLite3 extensions

0 commit comments

Comments
 (0)