Back to index

php5  5.3.10
Defines | Functions
common_error.c File Reference
#include "php_intl.h"
#include "intl_error.h"
#include "common_error.h"

Go to the source code of this file.

Defines

#define INTL_EXPOSE_CONST(x)   REGISTER_LONG_CONSTANT(#x, x, CONST_CS)

Functions

 PHP_FUNCTION (intl_get_error_code)
 PHP_FUNCTION (intl_get_error_message)
 PHP_FUNCTION (intl_is_failure)
 PHP_FUNCTION (intl_error_name)
void intl_expose_icu_error_codes (INIT_FUNC_ARGS)

Define Documentation

#define INTL_EXPOSE_CONST (   x)    REGISTER_LONG_CONSTANT(#x, x, CONST_CS)

Function Documentation

Definition at line 92 of file common_error.c.

{
       #define INTL_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS)

       /* Warnings */
       INTL_EXPOSE_CONST( U_USING_FALLBACK_WARNING );
       INTL_EXPOSE_CONST( U_ERROR_WARNING_START );
       INTL_EXPOSE_CONST( U_USING_DEFAULT_WARNING );
       INTL_EXPOSE_CONST( U_SAFECLONE_ALLOCATED_WARNING );
       INTL_EXPOSE_CONST( U_STATE_OLD_WARNING );
       INTL_EXPOSE_CONST( U_STRING_NOT_TERMINATED_WARNING );
       INTL_EXPOSE_CONST( U_SORT_KEY_TOO_SHORT_WARNING );
       INTL_EXPOSE_CONST( U_AMBIGUOUS_ALIAS_WARNING );
       INTL_EXPOSE_CONST( U_DIFFERENT_UCA_VERSION );
       INTL_EXPOSE_CONST( U_ERROR_WARNING_LIMIT );

       /* Standard errors */
       INTL_EXPOSE_CONST( U_ZERO_ERROR );
       INTL_EXPOSE_CONST( U_ILLEGAL_ARGUMENT_ERROR );
       INTL_EXPOSE_CONST( U_MISSING_RESOURCE_ERROR );
       INTL_EXPOSE_CONST( U_INVALID_FORMAT_ERROR );
       INTL_EXPOSE_CONST( U_FILE_ACCESS_ERROR );
       INTL_EXPOSE_CONST( U_INTERNAL_PROGRAM_ERROR );
       INTL_EXPOSE_CONST( U_MESSAGE_PARSE_ERROR );
       INTL_EXPOSE_CONST( U_MEMORY_ALLOCATION_ERROR );
       INTL_EXPOSE_CONST( U_INDEX_OUTOFBOUNDS_ERROR );
       INTL_EXPOSE_CONST( U_PARSE_ERROR );
       INTL_EXPOSE_CONST( U_INVALID_CHAR_FOUND );
       INTL_EXPOSE_CONST( U_TRUNCATED_CHAR_FOUND );
       INTL_EXPOSE_CONST( U_ILLEGAL_CHAR_FOUND );
       INTL_EXPOSE_CONST( U_INVALID_TABLE_FORMAT );
       INTL_EXPOSE_CONST( U_INVALID_TABLE_FILE );
       INTL_EXPOSE_CONST( U_BUFFER_OVERFLOW_ERROR );
       INTL_EXPOSE_CONST( U_UNSUPPORTED_ERROR );
       INTL_EXPOSE_CONST( U_RESOURCE_TYPE_MISMATCH );
       INTL_EXPOSE_CONST( U_ILLEGAL_ESCAPE_SEQUENCE );
       INTL_EXPOSE_CONST( U_UNSUPPORTED_ESCAPE_SEQUENCE );
       INTL_EXPOSE_CONST( U_NO_SPACE_AVAILABLE );
       INTL_EXPOSE_CONST( U_CE_NOT_FOUND_ERROR );
       INTL_EXPOSE_CONST( U_PRIMARY_TOO_LONG_ERROR );
       INTL_EXPOSE_CONST( U_STATE_TOO_OLD_ERROR );
       INTL_EXPOSE_CONST( U_TOO_MANY_ALIASES_ERROR );
       INTL_EXPOSE_CONST( U_ENUM_OUT_OF_SYNC_ERROR );
       INTL_EXPOSE_CONST( U_INVARIANT_CONVERSION_ERROR );
       INTL_EXPOSE_CONST( U_INVALID_STATE_ERROR );
       INTL_EXPOSE_CONST( U_COLLATOR_VERSION_MISMATCH );
       INTL_EXPOSE_CONST( U_USELESS_COLLATOR_ERROR );
       INTL_EXPOSE_CONST( U_NO_WRITE_PERMISSION );
       INTL_EXPOSE_CONST( U_STANDARD_ERROR_LIMIT );

       /* The error code range 0x10000 0x10100 are reserved for Transliterator */
       INTL_EXPOSE_CONST( U_BAD_VARIABLE_DEFINITION );
       INTL_EXPOSE_CONST( U_PARSE_ERROR_START );
       INTL_EXPOSE_CONST( U_MALFORMED_RULE );
       INTL_EXPOSE_CONST( U_MALFORMED_SET );
       INTL_EXPOSE_CONST( U_MALFORMED_SYMBOL_REFERENCE );
       INTL_EXPOSE_CONST( U_MALFORMED_UNICODE_ESCAPE );
       INTL_EXPOSE_CONST( U_MALFORMED_VARIABLE_DEFINITION );
       INTL_EXPOSE_CONST( U_MALFORMED_VARIABLE_REFERENCE );
       INTL_EXPOSE_CONST( U_MISMATCHED_SEGMENT_DELIMITERS );
       INTL_EXPOSE_CONST( U_MISPLACED_ANCHOR_START );
       INTL_EXPOSE_CONST( U_MISPLACED_CURSOR_OFFSET );
       INTL_EXPOSE_CONST( U_MISPLACED_QUANTIFIER );
       INTL_EXPOSE_CONST( U_MISSING_OPERATOR );
       INTL_EXPOSE_CONST( U_MISSING_SEGMENT_CLOSE );
       INTL_EXPOSE_CONST( U_MULTIPLE_ANTE_CONTEXTS );
       INTL_EXPOSE_CONST( U_MULTIPLE_CURSORS );
       INTL_EXPOSE_CONST( U_MULTIPLE_POST_CONTEXTS );
       INTL_EXPOSE_CONST( U_TRAILING_BACKSLASH );
       INTL_EXPOSE_CONST( U_UNDEFINED_SEGMENT_REFERENCE );
       INTL_EXPOSE_CONST( U_UNDEFINED_VARIABLE );
       INTL_EXPOSE_CONST( U_UNQUOTED_SPECIAL );
       INTL_EXPOSE_CONST( U_UNTERMINATED_QUOTE );
       INTL_EXPOSE_CONST( U_RULE_MASK_ERROR );
       INTL_EXPOSE_CONST( U_MISPLACED_COMPOUND_FILTER );
       INTL_EXPOSE_CONST( U_MULTIPLE_COMPOUND_FILTERS );
       INTL_EXPOSE_CONST( U_INVALID_RBT_SYNTAX );
       INTL_EXPOSE_CONST( U_INVALID_PROPERTY_PATTERN );
       INTL_EXPOSE_CONST( U_MALFORMED_PRAGMA );
       INTL_EXPOSE_CONST( U_UNCLOSED_SEGMENT );
       INTL_EXPOSE_CONST( U_ILLEGAL_CHAR_IN_SEGMENT );
       INTL_EXPOSE_CONST( U_VARIABLE_RANGE_EXHAUSTED );
       INTL_EXPOSE_CONST( U_VARIABLE_RANGE_OVERLAP );
       INTL_EXPOSE_CONST( U_ILLEGAL_CHARACTER );
       INTL_EXPOSE_CONST( U_INTERNAL_TRANSLITERATOR_ERROR );
       INTL_EXPOSE_CONST( U_INVALID_ID );
       INTL_EXPOSE_CONST( U_INVALID_FUNCTION );
       INTL_EXPOSE_CONST( U_PARSE_ERROR_LIMIT );

       /* The error code range 0x10100 0x10200 are reserved for formatting API parsing error */
       INTL_EXPOSE_CONST( U_UNEXPECTED_TOKEN );
       INTL_EXPOSE_CONST( U_FMT_PARSE_ERROR_START );
       INTL_EXPOSE_CONST( U_MULTIPLE_DECIMAL_SEPARATORS );
       INTL_EXPOSE_CONST( U_MULTIPLE_DECIMAL_SEPERATORS );    /* Typo: kept for backward compatibility. Use U_MULTIPLE_DECIMAL_SEPARATORS */
       INTL_EXPOSE_CONST( U_MULTIPLE_EXPONENTIAL_SYMBOLS );
       INTL_EXPOSE_CONST( U_MALFORMED_EXPONENTIAL_PATTERN );
       INTL_EXPOSE_CONST( U_MULTIPLE_PERCENT_SYMBOLS );
       INTL_EXPOSE_CONST( U_MULTIPLE_PERMILL_SYMBOLS );
       INTL_EXPOSE_CONST( U_MULTIPLE_PAD_SPECIFIERS );
       INTL_EXPOSE_CONST( U_PATTERN_SYNTAX_ERROR );
       INTL_EXPOSE_CONST( U_ILLEGAL_PAD_POSITION );
       INTL_EXPOSE_CONST( U_UNMATCHED_BRACES );
       INTL_EXPOSE_CONST( U_UNSUPPORTED_PROPERTY );
       INTL_EXPOSE_CONST( U_UNSUPPORTED_ATTRIBUTE );
       INTL_EXPOSE_CONST( U_FMT_PARSE_ERROR_LIMIT );

       /* The error code range 0x10200 0x102ff are reserved for Break Iterator related error */
       INTL_EXPOSE_CONST( U_BRK_INTERNAL_ERROR );
       INTL_EXPOSE_CONST( U_BRK_ERROR_START );
       INTL_EXPOSE_CONST( U_BRK_HEX_DIGITS_EXPECTED );
       INTL_EXPOSE_CONST( U_BRK_SEMICOLON_EXPECTED );
       INTL_EXPOSE_CONST( U_BRK_RULE_SYNTAX );
       INTL_EXPOSE_CONST( U_BRK_UNCLOSED_SET );
       INTL_EXPOSE_CONST( U_BRK_ASSIGN_ERROR );
       INTL_EXPOSE_CONST( U_BRK_VARIABLE_REDFINITION );
       INTL_EXPOSE_CONST( U_BRK_MISMATCHED_PAREN );
       INTL_EXPOSE_CONST( U_BRK_NEW_LINE_IN_QUOTED_STRING );
       INTL_EXPOSE_CONST( U_BRK_UNDEFINED_VARIABLE );
       INTL_EXPOSE_CONST( U_BRK_INIT_ERROR );
       INTL_EXPOSE_CONST( U_BRK_RULE_EMPTY_SET );
       INTL_EXPOSE_CONST( U_BRK_UNRECOGNIZED_OPTION );
       INTL_EXPOSE_CONST( U_BRK_MALFORMED_RULE_TAG );
       INTL_EXPOSE_CONST( U_BRK_ERROR_LIMIT );

       /* The error codes in the range 0x10300-0x103ff are reserved for regular expression related errrs */
       INTL_EXPOSE_CONST( U_REGEX_INTERNAL_ERROR );
       INTL_EXPOSE_CONST( U_REGEX_ERROR_START );
       INTL_EXPOSE_CONST( U_REGEX_RULE_SYNTAX );
       INTL_EXPOSE_CONST( U_REGEX_INVALID_STATE );
       INTL_EXPOSE_CONST( U_REGEX_BAD_ESCAPE_SEQUENCE );
       INTL_EXPOSE_CONST( U_REGEX_PROPERTY_SYNTAX );
       INTL_EXPOSE_CONST( U_REGEX_UNIMPLEMENTED );
       INTL_EXPOSE_CONST( U_REGEX_MISMATCHED_PAREN );
       INTL_EXPOSE_CONST( U_REGEX_NUMBER_TOO_BIG );
       INTL_EXPOSE_CONST( U_REGEX_BAD_INTERVAL );
       INTL_EXPOSE_CONST( U_REGEX_MAX_LT_MIN );
       INTL_EXPOSE_CONST( U_REGEX_INVALID_BACK_REF );
       INTL_EXPOSE_CONST( U_REGEX_INVALID_FLAG );
       INTL_EXPOSE_CONST( U_REGEX_LOOK_BEHIND_LIMIT );
       INTL_EXPOSE_CONST( U_REGEX_SET_CONTAINS_STRING );
       INTL_EXPOSE_CONST( U_REGEX_ERROR_LIMIT );

       /* The error code in the range 0x10400-0x104ff are reserved for IDNA related error codes */
#if defined(U_IDNA_PROHIBITED_ERROR)
       INTL_EXPOSE_CONST( U_IDNA_PROHIBITED_ERROR );
       INTL_EXPOSE_CONST( U_IDNA_ERROR_START );
       INTL_EXPOSE_CONST( U_IDNA_UNASSIGNED_ERROR );
       INTL_EXPOSE_CONST( U_IDNA_CHECK_BIDI_ERROR );
       INTL_EXPOSE_CONST( U_IDNA_STD3_ASCII_RULES_ERROR );
       INTL_EXPOSE_CONST( U_IDNA_ACE_PREFIX_ERROR );
       INTL_EXPOSE_CONST( U_IDNA_VERIFICATION_ERROR );
       INTL_EXPOSE_CONST( U_IDNA_LABEL_TOO_LONG_ERROR );
       INTL_EXPOSE_CONST( U_IDNA_ZERO_LENGTH_LABEL_ERROR );
       INTL_EXPOSE_CONST( U_IDNA_ERROR_LIMIT );
#endif

       /* Aliases for StringPrep */
       INTL_EXPOSE_CONST( U_STRINGPREP_PROHIBITED_ERROR );
       INTL_EXPOSE_CONST( U_STRINGPREP_UNASSIGNED_ERROR );
       INTL_EXPOSE_CONST( U_STRINGPREP_CHECK_BIDI_ERROR );

       INTL_EXPOSE_CONST( U_ERROR_LIMIT );

       #undef INTL_EXPOSE_CONST
}

Here is the caller graph for this function:

Definition at line 29 of file common_error.c.

Here is the call graph for this function:

Definition at line 38 of file common_error.c.

{
       char* message = intl_error_get_message( NULL TSRMLS_CC );
       RETURN_STRING( message, FALSE );
}

Here is the call graph for this function:

Definition at line 50 of file common_error.c.

{
       long err_code;

       /* Parse parameters. */
       if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l",
              &err_code ) == FAILURE )
       {
              intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
                     "intl_is_failure: unable to parse input params", 0 TSRMLS_CC );

              RETURN_FALSE;
       }

       RETURN_BOOL( U_FAILURE( err_code ) );
}

Here is the call graph for this function:

Definition at line 71 of file common_error.c.

{
       long err_code;

       /* Parse parameters. */
       if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l",
              &err_code ) == FAILURE )
       {
              intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
                     "intl_error_name: unable to parse input params", 0 TSRMLS_CC );

              RETURN_FALSE;
       }

       RETURN_STRING( (char*)u_errorName( err_code ), 1 );
}

Here is the call graph for this function: