mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
cleanup some code, improve error handling
This commit is contained in:
parent
f0c1cd512f
commit
882a89fb22
10 changed files with 74 additions and 41 deletions
|
@ -181,8 +181,7 @@ PHP_METHOD( IntlDateFormatter, __construct )
|
||||||
*/
|
*/
|
||||||
PHP_FUNCTION( datefmt_get_error_code )
|
PHP_FUNCTION( datefmt_get_error_code )
|
||||||
{
|
{
|
||||||
zval* object = NULL;
|
DATE_FORMAT_METHOD_INIT_VARS;
|
||||||
IntlDateFormatter_object* dfo = NULL;
|
|
||||||
|
|
||||||
/* Parse parameters. */
|
/* Parse parameters. */
|
||||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
|
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
|
||||||
|
@ -208,8 +207,7 @@ PHP_FUNCTION( datefmt_get_error_code )
|
||||||
PHP_FUNCTION( datefmt_get_error_message )
|
PHP_FUNCTION( datefmt_get_error_message )
|
||||||
{
|
{
|
||||||
char* message = NULL;
|
char* message = NULL;
|
||||||
zval* object = NULL;
|
DATE_FORMAT_METHOD_INIT_VARS;
|
||||||
IntlDateFormatter_object* dfo = NULL;
|
|
||||||
|
|
||||||
/* Parse parameters. */
|
/* Parse parameters. */
|
||||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
|
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
|
||||||
|
@ -224,7 +222,7 @@ PHP_FUNCTION( datefmt_get_error_message )
|
||||||
dfo = (IntlDateFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
|
dfo = (IntlDateFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
|
||||||
|
|
||||||
/* Return last error message. */
|
/* Return last error message. */
|
||||||
message = intl_error_get_message( &dfo->datef_data.error TSRMLS_CC );
|
message = intl_error_get_message( INTL_DATA_ERROR_P(dfo) TSRMLS_CC );
|
||||||
RETURN_STRING( message, 0);
|
RETURN_STRING( message, 0);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
|
@ -141,7 +141,7 @@ PHP_FUNCTION( numfmt_get_error_message )
|
||||||
nfo = (NumberFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
|
nfo = (NumberFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
|
||||||
|
|
||||||
/* Return last error message. */
|
/* Return last error message. */
|
||||||
message = intl_error_get_message( &INTL_DATA_ERROR(nfo) TSRMLS_CC );
|
message = intl_error_get_message( INTL_DATA_ERROR_P(nfo) TSRMLS_CC );
|
||||||
RETURN_STRING( message, 0);
|
RETURN_STRING( message, 0);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
|
@ -83,7 +83,7 @@ PHP_FUNCTION(grapheme_strlen)
|
||||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
|
||||||
efree( ustring );
|
efree( ustring );
|
||||||
RETURN_NULL();
|
RETURN_NULL();
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ PHP_FUNCTION(grapheme_substr)
|
||||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
|
||||||
efree( ustr );
|
efree( ustr );
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ PHP_FUNCTION(grapheme_substr)
|
||||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 0 TSRMLS_CC );
|
||||||
|
|
||||||
efree( sub_str );
|
efree( sub_str );
|
||||||
|
|
||||||
|
@ -563,7 +563,7 @@ PHP_FUNCTION(grapheme_substr)
|
||||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 0 TSRMLS_CC );
|
||||||
|
|
||||||
if ( NULL != sub_str )
|
if ( NULL != sub_str )
|
||||||
efree( sub_str );
|
efree( sub_str );
|
||||||
|
@ -870,7 +870,7 @@ PHP_FUNCTION(grapheme_extract)
|
||||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
|
||||||
|
|
||||||
if ( NULL != ustr )
|
if ( NULL != ustr )
|
||||||
efree( ustr );
|
efree( ustr );
|
||||||
|
|
|
@ -169,7 +169,7 @@ grapheme_strrpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned c
|
||||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
|
||||||
efree( uhaystack );
|
efree( uhaystack );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ grapheme_strrpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned c
|
||||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
|
||||||
efree( uhaystack );
|
efree( uhaystack );
|
||||||
efree( uneedle );
|
efree( uneedle );
|
||||||
ubrk_close (bi);
|
ubrk_close (bi);
|
||||||
|
@ -294,7 +294,7 @@ grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned ch
|
||||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
|
||||||
efree( uhaystack );
|
efree( uhaystack );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned ch
|
||||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
|
||||||
efree( uhaystack );
|
efree( uhaystack );
|
||||||
efree( uneedle );
|
efree( uneedle );
|
||||||
ubrk_close (bi);
|
ubrk_close (bi);
|
||||||
|
|
|
@ -84,7 +84,7 @@ static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||||
intl_error_set_code(NULL, status TSRMLS_CC);
|
intl_error_set_code(NULL, status TSRMLS_CC);
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
|
||||||
efree(ustring);
|
efree(ustring);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -111,7 +111,7 @@ static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||||
intl_error_set_code(NULL, status TSRMLS_CC);
|
intl_error_set_code(NULL, status TSRMLS_CC);
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 0 TSRMLS_CC );
|
||||||
efree(converted_utf8);
|
efree(converted_utf8);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,9 @@ static void intl_free_custom_error_msg( intl_error* err TSRMLS_DC )
|
||||||
if( !err && !( err = intl_g_error_get( TSRMLS_C ) ) )
|
if( !err && !( err = intl_g_error_get( TSRMLS_C ) ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !err->free_custom_error_message )
|
if(err->free_custom_error_message ) {
|
||||||
return;
|
efree( err->custom_error_message );
|
||||||
|
}
|
||||||
efree( err->custom_error_message );
|
|
||||||
|
|
||||||
err->custom_error_message = NULL;
|
err->custom_error_message = NULL;
|
||||||
err->free_custom_error_message = 0;
|
err->free_custom_error_message = 0;
|
||||||
|
@ -181,6 +180,16 @@ void intl_error_set( intl_error* err, UErrorCode code, char* msg, int copyMsg TS
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
/* {{{ void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg )
|
||||||
|
* Set error code and message.
|
||||||
|
*/
|
||||||
|
void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC )
|
||||||
|
{
|
||||||
|
intl_errors_set_code( err, code TSRMLS_CC );
|
||||||
|
intl_errors_set_custom_msg( err, msg, copyMsg TSRMLS_CC );
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ void intl_errors_reset( intl_error* err )
|
/* {{{ void intl_errors_reset( intl_error* err )
|
||||||
*/
|
*/
|
||||||
void intl_errors_reset( intl_error* err TSRMLS_DC )
|
void intl_errors_reset( intl_error* err TSRMLS_DC )
|
||||||
|
|
|
@ -42,5 +42,6 @@ char* intl_error_get_message( intl_error* err TSRMLS_DC );
|
||||||
void intl_errors_reset( intl_error* err TSRMLS_DC );
|
void intl_errors_reset( intl_error* err TSRMLS_DC );
|
||||||
void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg TSRMLS_DC );
|
void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg TSRMLS_DC );
|
||||||
void intl_errors_set_code( intl_error* err, UErrorCode err_code TSRMLS_DC );
|
void intl_errors_set_code( intl_error* err, UErrorCode err_code TSRMLS_DC );
|
||||||
|
void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC );
|
||||||
|
|
||||||
#endif // INTL_ERROR_H
|
#endif // INTL_ERROR_H
|
||||||
|
|
|
@ -389,7 +389,7 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
|
||||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, msg , 1 TSRMLS_CC );
|
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, msg , 1 TSRMLS_CC );
|
||||||
efree(msg);
|
efree(msg);
|
||||||
|
|
||||||
RETURN_NULL();
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(loc_name_len == 0) {
|
if(loc_name_len == 0) {
|
||||||
|
@ -1129,10 +1129,10 @@ PHP_FUNCTION(locale_get_all_variants)
|
||||||
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s",
|
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s",
|
||||||
&loc_name, &loc_name_len ) == FAILURE)
|
&loc_name, &loc_name_len ) == FAILURE)
|
||||||
{
|
{
|
||||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||||
"locale_parse: unable to parse input params", 0 TSRMLS_CC );
|
"locale_parse: unable to parse input params", 0 TSRMLS_CC );
|
||||||
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(loc_name_len == 0) {
|
if(loc_name_len == 0) {
|
||||||
|
@ -1524,7 +1524,7 @@ PHP_FUNCTION(locale_lookup)
|
||||||
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "as|bs", &arr, &loc_range, &loc_range_len,
|
if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "as|bs", &arr, &loc_range, &loc_range_len,
|
||||||
&boolCanonical, &fallback_loc, &fallback_loc_len) == FAILURE) {
|
&boolCanonical, &fallback_loc, &fallback_loc_len) == FAILURE) {
|
||||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_lookup: unable to parse input params", 0 TSRMLS_CC );
|
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_lookup: unable to parse input params", 0 TSRMLS_CC );
|
||||||
RETURN_NULL();
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(loc_range_len == 0) {
|
if(loc_range_len == 0) {
|
||||||
|
@ -1571,7 +1571,7 @@ PHP_FUNCTION(locale_accept_from_http)
|
||||||
{
|
{
|
||||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||||
"locale_accept_from_http: unable to parse input parameters", 0 TSRMLS_CC );
|
"locale_accept_from_http: unable to parse input parameters", 0 TSRMLS_CC );
|
||||||
RETURN_NULL();
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
available = ures_openAvailableLocales(NULL, &status);
|
available = ures_openAvailableLocales(NULL, &status);
|
||||||
|
|
|
@ -57,9 +57,9 @@ PHP_FUNCTION( normalizer_normalize )
|
||||||
&input, &input_len, &form ) == FAILURE )
|
&input, &input_len, &form ) == FAILURE )
|
||||||
{
|
{
|
||||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||||
"normalizer_normalize: unable to parse input params", 1 TSRMLS_CC );
|
"normalizer_normalize: unable to parse input params", 0 TSRMLS_CC );
|
||||||
|
|
||||||
RETURN_NULL();
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
expansion_factor = 1;
|
expansion_factor = 1;
|
||||||
|
@ -78,8 +78,8 @@ PHP_FUNCTION( normalizer_normalize )
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||||
"normalizer_normalize: illegal normalization form", 1 TSRMLS_CC );
|
"normalizer_normalize: illegal normalization form", 0 TSRMLS_CC );
|
||||||
RETURN_NULL();
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -95,9 +95,9 @@ PHP_FUNCTION( normalizer_normalize )
|
||||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
|
||||||
efree( uinput );
|
efree( uinput );
|
||||||
RETURN_NULL();
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,10 +134,10 @@ PHP_FUNCTION( normalizer_normalize )
|
||||||
/* Bail out if an unexpected error occured. */
|
/* Bail out if an unexpected error occured. */
|
||||||
if( U_FAILURE(status) ) {
|
if( U_FAILURE(status) ) {
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL,"Error normalizing string", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL,"Error normalizing string", 0 TSRMLS_CC );
|
||||||
efree( uret_buf );
|
efree( uret_buf );
|
||||||
efree( uinput );
|
efree( uinput );
|
||||||
RETURN_NULL();
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +152,8 @@ PHP_FUNCTION( normalizer_normalize )
|
||||||
if( U_FAILURE( status ) )
|
if( U_FAILURE( status ) )
|
||||||
{
|
{
|
||||||
intl_error_set( NULL, status,
|
intl_error_set( NULL, status,
|
||||||
"normalizer_normalize: error converting normalized text UTF-8", 1 TSRMLS_CC );
|
"normalizer_normalize: error converting normalized text UTF-8", 0 TSRMLS_CC );
|
||||||
RETURN_NULL();
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return it. */
|
/* Return it. */
|
||||||
|
@ -186,7 +186,7 @@ PHP_FUNCTION( normalizer_is_normalized )
|
||||||
&input, &input_len, &form) == FAILURE )
|
&input, &input_len, &form) == FAILURE )
|
||||||
{
|
{
|
||||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||||
"normalizer_is_normalized: unable to parse input params", 1 TSRMLS_CC );
|
"normalizer_is_normalized: unable to parse input params", 0 TSRMLS_CC );
|
||||||
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -201,8 +201,8 @@ PHP_FUNCTION( normalizer_is_normalized )
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||||
"normalizer_normalize: illegal normalization form", 1 TSRMLS_CC );
|
"normalizer_normalize: illegal normalization form", 0 TSRMLS_CC );
|
||||||
RETURN_NULL();
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ PHP_FUNCTION( normalizer_is_normalized )
|
||||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||||
|
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL, "Error converting string to UTF-16.", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL, "Error converting string to UTF-16.", 0 TSRMLS_CC );
|
||||||
efree( uinput );
|
efree( uinput );
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ PHP_FUNCTION( normalizer_is_normalized )
|
||||||
/* Bail out if an unexpected error occured. */
|
/* Bail out if an unexpected error occured. */
|
||||||
if( U_FAILURE(status) ) {
|
if( U_FAILURE(status) ) {
|
||||||
/* Set error messages. */
|
/* Set error messages. */
|
||||||
intl_error_set_custom_msg( NULL,"Error testing if string is the given normalization form.", 1 TSRMLS_CC );
|
intl_error_set_custom_msg( NULL,"Error testing if string is the given normalization form.", 0 TSRMLS_CC );
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
25
ext/intl/tests/badargs.phpt
Executable file
25
ext/intl/tests/badargs.phpt
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
--TEST--
|
||||||
|
Check that bad argumens return the same
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$funcs = get_extension_funcs("intl");
|
||||||
|
function ignore_err() {}
|
||||||
|
set_error_handler("ignore_err");
|
||||||
|
$arg = new stdClass();
|
||||||
|
foreach($funcs as $func) {
|
||||||
|
$rfunc = new ReflectionFunction($func);
|
||||||
|
if($rfunc->getNumberOfRequiredParameters() == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$res = $func($arg);
|
||||||
|
if($res != false) {
|
||||||
|
echo "$func: ";
|
||||||
|
var_dump($res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "OK!\n";
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
OK!
|
Loading…
Add table
Add a link
Reference in a new issue