PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - ext/intl/common - common_error.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 0 158 0.0 %
Date: 2014-04-16 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | PHP Version 5                                                        |
       4             :    +----------------------------------------------------------------------+
       5             :    | This source file is subject to version 3.01 of the PHP license,      |
       6             :    | that is bundled with this package in the file LICENSE, and is        |
       7             :    | available through the world-wide-web at the following url:           |
       8             :    | http://www.php.net/license/3_01.txt                                  |
       9             :    | If you did not receive a copy of the PHP license and are unable to   |
      10             :    | obtain it through the world-wide-web, please send a note to          |
      11             :    | license@php.net so we can mail you a copy immediately.               |
      12             :    +----------------------------------------------------------------------+
      13             :    | Authors: Vadim Savchuk <vsavchuk@productengine.com>                  |
      14             :    |          Dmitry Lakhtyuk <dlakhtyuk@productengine.com>               |
      15             :    +----------------------------------------------------------------------+
      16             :  */
      17             : 
      18             : #ifdef HAVE_CONFIG_H
      19             : #include "config.h"
      20             : #endif
      21             : 
      22             : #include "php_intl.h"
      23             : #include "intl_error.h"
      24             : #include "common_error.h"
      25             : 
      26             : /* {{{ proto int intl_get_error_code()
      27             :  * Get code of the last occurred error.
      28             :  */
      29           0 : PHP_FUNCTION( intl_get_error_code )
      30             : {
      31           0 :         RETURN_LONG( intl_error_get_code( NULL TSRMLS_CC ) );
      32             : }
      33             : /* }}} */
      34             : 
      35             : /* {{{ proto string intl_get_error_message()
      36             :  * Get text description of the last occurred error.
      37             :  */
      38           0 : PHP_FUNCTION( intl_get_error_message )
      39             : {
      40           0 :         char* message = intl_error_get_message( NULL TSRMLS_CC );
      41           0 :         RETURN_STRING( message, FALSE );
      42             : }
      43             : /* }}} */
      44             : 
      45             : /* {{{ proto bool intl_is_failure()
      46             :  * Check whether the given error code indicates a failure.
      47             :  * Returns true if it does, and false if the code
      48             :  * indicates success or a warning.
      49             :  */
      50           0 : PHP_FUNCTION( intl_is_failure )
      51             : {
      52             :         long err_code;
      53             : 
      54             :         /* Parse parameters. */
      55           0 :         if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l",
      56             :                 &err_code ) == FAILURE )
      57             :         {
      58           0 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
      59             :                         "intl_is_failure: unable to parse input params", 0 TSRMLS_CC );
      60             : 
      61           0 :                 RETURN_FALSE;
      62             :         }
      63             : 
      64           0 :         RETURN_BOOL( U_FAILURE( err_code ) );
      65             : }
      66             : 
      67             : /* {{{ proto string intl_error_name()
      68             :  * Return a string for a given error code.
      69             :  * The string will be the same as the name of the error code constant.
      70             :  */
      71           0 : PHP_FUNCTION( intl_error_name )
      72             : {
      73             :         long err_code;
      74             : 
      75             :         /* Parse parameters. */
      76           0 :         if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l",
      77             :                 &err_code ) == FAILURE )
      78             :         {
      79           0 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
      80             :                         "intl_error_name: unable to parse input params", 0 TSRMLS_CC );
      81             : 
      82           0 :                 RETURN_FALSE;
      83             :         }
      84             : 
      85           0 :         RETURN_STRING( (char*)u_errorName( err_code ), 1 );
      86             : }
      87             : /* }}} */
      88             : 
      89             : /* {{{ intl_expose_icu_error_codes
      90             :  * Expose ICU error codes
      91             :  */
      92           0 : void intl_expose_icu_error_codes( INIT_FUNC_ARGS )
      93             : {
      94             :         #define INTL_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS)
      95             : 
      96             :         /* Warnings */
      97           0 :         INTL_EXPOSE_CONST( U_USING_FALLBACK_WARNING );
      98           0 :         INTL_EXPOSE_CONST( U_ERROR_WARNING_START );
      99           0 :         INTL_EXPOSE_CONST( U_USING_DEFAULT_WARNING );
     100           0 :         INTL_EXPOSE_CONST( U_SAFECLONE_ALLOCATED_WARNING );
     101           0 :         INTL_EXPOSE_CONST( U_STATE_OLD_WARNING );
     102           0 :         INTL_EXPOSE_CONST( U_STRING_NOT_TERMINATED_WARNING );
     103           0 :         INTL_EXPOSE_CONST( U_SORT_KEY_TOO_SHORT_WARNING );
     104           0 :         INTL_EXPOSE_CONST( U_AMBIGUOUS_ALIAS_WARNING );
     105           0 :         INTL_EXPOSE_CONST( U_DIFFERENT_UCA_VERSION );
     106           0 :         INTL_EXPOSE_CONST( U_ERROR_WARNING_LIMIT );
     107             : 
     108             :         /* Standard errors */
     109           0 :         INTL_EXPOSE_CONST( U_ZERO_ERROR );
     110           0 :         INTL_EXPOSE_CONST( U_ILLEGAL_ARGUMENT_ERROR );
     111           0 :         INTL_EXPOSE_CONST( U_MISSING_RESOURCE_ERROR );
     112           0 :         INTL_EXPOSE_CONST( U_INVALID_FORMAT_ERROR );
     113           0 :         INTL_EXPOSE_CONST( U_FILE_ACCESS_ERROR );
     114           0 :         INTL_EXPOSE_CONST( U_INTERNAL_PROGRAM_ERROR );
     115           0 :         INTL_EXPOSE_CONST( U_MESSAGE_PARSE_ERROR );
     116           0 :         INTL_EXPOSE_CONST( U_MEMORY_ALLOCATION_ERROR );
     117           0 :         INTL_EXPOSE_CONST( U_INDEX_OUTOFBOUNDS_ERROR );
     118           0 :         INTL_EXPOSE_CONST( U_PARSE_ERROR );
     119           0 :         INTL_EXPOSE_CONST( U_INVALID_CHAR_FOUND );
     120           0 :         INTL_EXPOSE_CONST( U_TRUNCATED_CHAR_FOUND );
     121           0 :         INTL_EXPOSE_CONST( U_ILLEGAL_CHAR_FOUND );
     122           0 :         INTL_EXPOSE_CONST( U_INVALID_TABLE_FORMAT );
     123           0 :         INTL_EXPOSE_CONST( U_INVALID_TABLE_FILE );
     124           0 :         INTL_EXPOSE_CONST( U_BUFFER_OVERFLOW_ERROR );
     125           0 :         INTL_EXPOSE_CONST( U_UNSUPPORTED_ERROR );
     126           0 :         INTL_EXPOSE_CONST( U_RESOURCE_TYPE_MISMATCH );
     127           0 :         INTL_EXPOSE_CONST( U_ILLEGAL_ESCAPE_SEQUENCE );
     128           0 :         INTL_EXPOSE_CONST( U_UNSUPPORTED_ESCAPE_SEQUENCE );
     129           0 :         INTL_EXPOSE_CONST( U_NO_SPACE_AVAILABLE );
     130           0 :         INTL_EXPOSE_CONST( U_CE_NOT_FOUND_ERROR );
     131           0 :         INTL_EXPOSE_CONST( U_PRIMARY_TOO_LONG_ERROR );
     132           0 :         INTL_EXPOSE_CONST( U_STATE_TOO_OLD_ERROR );
     133           0 :         INTL_EXPOSE_CONST( U_TOO_MANY_ALIASES_ERROR );
     134           0 :         INTL_EXPOSE_CONST( U_ENUM_OUT_OF_SYNC_ERROR );
     135           0 :         INTL_EXPOSE_CONST( U_INVARIANT_CONVERSION_ERROR );
     136           0 :         INTL_EXPOSE_CONST( U_INVALID_STATE_ERROR );
     137           0 :         INTL_EXPOSE_CONST( U_COLLATOR_VERSION_MISMATCH );
     138           0 :         INTL_EXPOSE_CONST( U_USELESS_COLLATOR_ERROR );
     139           0 :         INTL_EXPOSE_CONST( U_NO_WRITE_PERMISSION );
     140           0 :         INTL_EXPOSE_CONST( U_STANDARD_ERROR_LIMIT );
     141             : 
     142             :         /* The error code range 0x10000 0x10100 are reserved for Transliterator */
     143           0 :         INTL_EXPOSE_CONST( U_BAD_VARIABLE_DEFINITION );
     144           0 :         INTL_EXPOSE_CONST( U_PARSE_ERROR_START );
     145           0 :         INTL_EXPOSE_CONST( U_MALFORMED_RULE );
     146           0 :         INTL_EXPOSE_CONST( U_MALFORMED_SET );
     147           0 :         INTL_EXPOSE_CONST( U_MALFORMED_SYMBOL_REFERENCE );
     148           0 :         INTL_EXPOSE_CONST( U_MALFORMED_UNICODE_ESCAPE );
     149           0 :         INTL_EXPOSE_CONST( U_MALFORMED_VARIABLE_DEFINITION );
     150           0 :         INTL_EXPOSE_CONST( U_MALFORMED_VARIABLE_REFERENCE );
     151           0 :         INTL_EXPOSE_CONST( U_MISMATCHED_SEGMENT_DELIMITERS );
     152           0 :         INTL_EXPOSE_CONST( U_MISPLACED_ANCHOR_START );
     153           0 :         INTL_EXPOSE_CONST( U_MISPLACED_CURSOR_OFFSET );
     154           0 :         INTL_EXPOSE_CONST( U_MISPLACED_QUANTIFIER );
     155           0 :         INTL_EXPOSE_CONST( U_MISSING_OPERATOR );
     156           0 :         INTL_EXPOSE_CONST( U_MISSING_SEGMENT_CLOSE );
     157           0 :         INTL_EXPOSE_CONST( U_MULTIPLE_ANTE_CONTEXTS );
     158           0 :         INTL_EXPOSE_CONST( U_MULTIPLE_CURSORS );
     159           0 :         INTL_EXPOSE_CONST( U_MULTIPLE_POST_CONTEXTS );
     160           0 :         INTL_EXPOSE_CONST( U_TRAILING_BACKSLASH );
     161           0 :         INTL_EXPOSE_CONST( U_UNDEFINED_SEGMENT_REFERENCE );
     162           0 :         INTL_EXPOSE_CONST( U_UNDEFINED_VARIABLE );
     163           0 :         INTL_EXPOSE_CONST( U_UNQUOTED_SPECIAL );
     164           0 :         INTL_EXPOSE_CONST( U_UNTERMINATED_QUOTE );
     165           0 :         INTL_EXPOSE_CONST( U_RULE_MASK_ERROR );
     166           0 :         INTL_EXPOSE_CONST( U_MISPLACED_COMPOUND_FILTER );
     167           0 :         INTL_EXPOSE_CONST( U_MULTIPLE_COMPOUND_FILTERS );
     168           0 :         INTL_EXPOSE_CONST( U_INVALID_RBT_SYNTAX );
     169           0 :         INTL_EXPOSE_CONST( U_INVALID_PROPERTY_PATTERN );
     170           0 :         INTL_EXPOSE_CONST( U_MALFORMED_PRAGMA );
     171           0 :         INTL_EXPOSE_CONST( U_UNCLOSED_SEGMENT );
     172           0 :         INTL_EXPOSE_CONST( U_ILLEGAL_CHAR_IN_SEGMENT );
     173           0 :         INTL_EXPOSE_CONST( U_VARIABLE_RANGE_EXHAUSTED );
     174           0 :         INTL_EXPOSE_CONST( U_VARIABLE_RANGE_OVERLAP );
     175           0 :         INTL_EXPOSE_CONST( U_ILLEGAL_CHARACTER );
     176           0 :         INTL_EXPOSE_CONST( U_INTERNAL_TRANSLITERATOR_ERROR );
     177           0 :         INTL_EXPOSE_CONST( U_INVALID_ID );
     178           0 :         INTL_EXPOSE_CONST( U_INVALID_FUNCTION );
     179           0 :         INTL_EXPOSE_CONST( U_PARSE_ERROR_LIMIT );
     180             : 
     181             :         /* The error code range 0x10100 0x10200 are reserved for formatting API parsing error */
     182           0 :         INTL_EXPOSE_CONST( U_UNEXPECTED_TOKEN );
     183           0 :         INTL_EXPOSE_CONST( U_FMT_PARSE_ERROR_START );
     184           0 :         INTL_EXPOSE_CONST( U_MULTIPLE_DECIMAL_SEPARATORS );
     185           0 :         INTL_EXPOSE_CONST( U_MULTIPLE_DECIMAL_SEPERATORS );    /* Typo: kept for backward compatibility. Use U_MULTIPLE_DECIMAL_SEPARATORS */
     186           0 :         INTL_EXPOSE_CONST( U_MULTIPLE_EXPONENTIAL_SYMBOLS );
     187           0 :         INTL_EXPOSE_CONST( U_MALFORMED_EXPONENTIAL_PATTERN );
     188           0 :         INTL_EXPOSE_CONST( U_MULTIPLE_PERCENT_SYMBOLS );
     189           0 :         INTL_EXPOSE_CONST( U_MULTIPLE_PERMILL_SYMBOLS );
     190           0 :         INTL_EXPOSE_CONST( U_MULTIPLE_PAD_SPECIFIERS );
     191           0 :         INTL_EXPOSE_CONST( U_PATTERN_SYNTAX_ERROR );
     192           0 :         INTL_EXPOSE_CONST( U_ILLEGAL_PAD_POSITION );
     193           0 :         INTL_EXPOSE_CONST( U_UNMATCHED_BRACES );
     194           0 :         INTL_EXPOSE_CONST( U_UNSUPPORTED_PROPERTY );
     195           0 :         INTL_EXPOSE_CONST( U_UNSUPPORTED_ATTRIBUTE );
     196           0 :         INTL_EXPOSE_CONST( U_FMT_PARSE_ERROR_LIMIT );
     197             : 
     198             :         /* The error code range 0x10200 0x102ff are reserved for Break Iterator related error */
     199           0 :         INTL_EXPOSE_CONST( U_BRK_INTERNAL_ERROR );
     200           0 :         INTL_EXPOSE_CONST( U_BRK_ERROR_START );
     201           0 :         INTL_EXPOSE_CONST( U_BRK_HEX_DIGITS_EXPECTED );
     202           0 :         INTL_EXPOSE_CONST( U_BRK_SEMICOLON_EXPECTED );
     203           0 :         INTL_EXPOSE_CONST( U_BRK_RULE_SYNTAX );
     204           0 :         INTL_EXPOSE_CONST( U_BRK_UNCLOSED_SET );
     205           0 :         INTL_EXPOSE_CONST( U_BRK_ASSIGN_ERROR );
     206           0 :         INTL_EXPOSE_CONST( U_BRK_VARIABLE_REDFINITION );
     207           0 :         INTL_EXPOSE_CONST( U_BRK_MISMATCHED_PAREN );
     208           0 :         INTL_EXPOSE_CONST( U_BRK_NEW_LINE_IN_QUOTED_STRING );
     209           0 :         INTL_EXPOSE_CONST( U_BRK_UNDEFINED_VARIABLE );
     210           0 :         INTL_EXPOSE_CONST( U_BRK_INIT_ERROR );
     211           0 :         INTL_EXPOSE_CONST( U_BRK_RULE_EMPTY_SET );
     212           0 :         INTL_EXPOSE_CONST( U_BRK_UNRECOGNIZED_OPTION );
     213           0 :         INTL_EXPOSE_CONST( U_BRK_MALFORMED_RULE_TAG );
     214           0 :         INTL_EXPOSE_CONST( U_BRK_ERROR_LIMIT );
     215             : 
     216             :         /* The error codes in the range 0x10300-0x103ff are reserved for regular expression related errrs */
     217           0 :         INTL_EXPOSE_CONST( U_REGEX_INTERNAL_ERROR );
     218           0 :         INTL_EXPOSE_CONST( U_REGEX_ERROR_START );
     219           0 :         INTL_EXPOSE_CONST( U_REGEX_RULE_SYNTAX );
     220           0 :         INTL_EXPOSE_CONST( U_REGEX_INVALID_STATE );
     221           0 :         INTL_EXPOSE_CONST( U_REGEX_BAD_ESCAPE_SEQUENCE );
     222           0 :         INTL_EXPOSE_CONST( U_REGEX_PROPERTY_SYNTAX );
     223           0 :         INTL_EXPOSE_CONST( U_REGEX_UNIMPLEMENTED );
     224           0 :         INTL_EXPOSE_CONST( U_REGEX_MISMATCHED_PAREN );
     225           0 :         INTL_EXPOSE_CONST( U_REGEX_NUMBER_TOO_BIG );
     226           0 :         INTL_EXPOSE_CONST( U_REGEX_BAD_INTERVAL );
     227           0 :         INTL_EXPOSE_CONST( U_REGEX_MAX_LT_MIN );
     228           0 :         INTL_EXPOSE_CONST( U_REGEX_INVALID_BACK_REF );
     229           0 :         INTL_EXPOSE_CONST( U_REGEX_INVALID_FLAG );
     230           0 :         INTL_EXPOSE_CONST( U_REGEX_LOOK_BEHIND_LIMIT );
     231           0 :         INTL_EXPOSE_CONST( U_REGEX_SET_CONTAINS_STRING );
     232           0 :         INTL_EXPOSE_CONST( U_REGEX_ERROR_LIMIT );
     233             : 
     234             :         /* The error code in the range 0x10400-0x104ff are reserved for IDNA related error codes */
     235           0 :         INTL_EXPOSE_CONST( U_IDNA_PROHIBITED_ERROR );
     236           0 :         INTL_EXPOSE_CONST( U_IDNA_ERROR_START );
     237           0 :         INTL_EXPOSE_CONST( U_IDNA_UNASSIGNED_ERROR );
     238           0 :         INTL_EXPOSE_CONST( U_IDNA_CHECK_BIDI_ERROR );
     239           0 :         INTL_EXPOSE_CONST( U_IDNA_STD3_ASCII_RULES_ERROR );
     240           0 :         INTL_EXPOSE_CONST( U_IDNA_ACE_PREFIX_ERROR );
     241           0 :         INTL_EXPOSE_CONST( U_IDNA_VERIFICATION_ERROR );
     242           0 :         INTL_EXPOSE_CONST( U_IDNA_LABEL_TOO_LONG_ERROR );
     243           0 :         INTL_EXPOSE_CONST( U_IDNA_ZERO_LENGTH_LABEL_ERROR );
     244             : #if U_ICU_VERSION_MAJOR_NUM > 3 || U_ICU_VERSION_MAJOR_NUM == 3 && U_ICU_VERSION_MINOR_NUM >= 8
     245           0 :         INTL_EXPOSE_CONST( U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR );
     246             : #endif
     247           0 :         INTL_EXPOSE_CONST( U_IDNA_ERROR_LIMIT );
     248             : 
     249             :         /* Aliases for StringPrep */
     250           0 :         INTL_EXPOSE_CONST( U_STRINGPREP_PROHIBITED_ERROR );
     251           0 :         INTL_EXPOSE_CONST( U_STRINGPREP_UNASSIGNED_ERROR );
     252           0 :         INTL_EXPOSE_CONST( U_STRINGPREP_CHECK_BIDI_ERROR );
     253             : 
     254           0 :         INTL_EXPOSE_CONST( U_ERROR_LIMIT );
     255             : 
     256             :         #undef INTL_EXPOSE_CONST
     257           0 : }
     258             : /* }}} */
     259             : 
     260             : /*
     261             :  * Local variables:
     262             :  * tab-width: 4
     263             :  * c-basic-offset: 4
     264             :  * End:
     265             :  * vim600: noet sw=4 ts=4 fdm=marker
     266             :  * vim<600: noet sw=4 ts=4
     267             :  */

Generated by: LCOV version 1.10

Generated at Wed, 16 Apr 2014 12:47:49 +0000 (7 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.