errormodule.java

来自「RESIN 3.2 最新源码」· Java 代码 · 共 584 行 · 第 1/2 页

JAVA
584
字号
      }          String name;            if (isRequire)        name = "require_once";      else        name = "include_once";            call.put(env.createString("function"), env.createString(name));    }  }  // Return an array that contains the values passed  // into a function as the arguments. IF no values  // were passed this method returns an empty array.  private static ArrayValueImpl evalArgsArray(Env env, FunctionExpr callExpr)  {    ArrayValueImpl args = new ArrayValueImpl();    Value []argsValues = callExpr.evalArguments(env);    if (argsValues != null) {      for (int index=0; index < argsValues.length; index++) {        Value ref = argsValues[index].toRefVar();        args.put(ref);      }    }    return args;  }  private static String unmangleFile(String className)  {    int i = "_quercus".length();    int end = className.indexOf('$');    if (end < 0)      end = className.length();        StringBuilder sb = new StringBuilder();    for (; i < end; i++) {      char ch = className.charAt(i);      if (ch == '.' && className.charAt(i + 1) == '_') {	sb.append('/');	i++;      }      else if (ch != '_') {	sb.append(ch);      }      else if (className.charAt(i + 1) == '_') {	sb.append('.');	i++;      }      else {	//System.out.println("UNKNOWN:" + className.charAt(i + 1) + " " + className);      }    }    return sb.toString();  }  private static String unmangleFunction(String className)  {    int p = className.lastIndexOf("$fun_");    if (p > 0)      return className.substring(p + "$fun_".length());    else      return className;  }  private static String unmangleClass(String className)  {    int p = className.lastIndexOf("$quercus_");    int q = className.lastIndexOf("$");    if (p > 0 && p < q)      return className.substring(p + "$quercus_".length(), q);    else      return className;  }  /**   * Write an error   */  /*  public Value error(Env env, String msg)    throws Exception  {    // XXX: valiate    env.error(msg);    return NullValue.NULL;  }  */  /**   * Exits   */  public Value exit(Env env, @Optional Value msg)  {    return env.exit(msg);  }  /**   * Send a message to the log.   */  public static boolean error_log(Env env,                                  StringValue message,                                  @Optional("0") int type,                                  @Optional StringValue destination,                                  @Optional StringValue extraHeaders)  {    if (type == 3) {      // message is appended to the file destination, no newline added      Value numBytes = FileModule.file_put_contents(env,        destination, message, FileModule.FILE_APPEND, null);      if (numBytes == BooleanValue.FALSE)        return false;      if (numBytes.toLong() == message.length())        return true;      else        return false;    } else if (type == 2) {      // XXX : message sent via remote debugging connection      return false;    } else if (type == 1) {      // XXX : message sent by email to the address in destination      return false;    } else {      // message sent to PHP's system logger      log.warning(message.toString());      return true;    }  }  /**   * Changes the error reporting value.   */  public static long error_reporting(Env env,                                     @Optional Value levelV)  {    if (levelV instanceof DefaultValue)      return env.getErrorMask();    else      return env.setErrorMask(levelV.toInt());  }  /**   * Restores the error handler   *   * @param env the quercus environment   */  public static boolean restore_error_handler(Env env)  {    env.restoreErrorHandler();    return true;  }  /**   * Sets an error handler   *   * @param env the quercus environment   * @param fun the error handler   * @param code errorMask error level   */  public static boolean set_error_handler(Env env,					  Callback fun,					  @Optional("E_ALL") int errorMask)  {    env.setErrorHandler(errorMask, fun);    return true;  }  /**   * Sets an exception handler   *   * @param env the quercus environment   * @param fun the exception handler   */  public static Value set_exception_handler(Env env,					    Callback fun)  {    return env.setExceptionHandler(fun);  }  /**   * Restore an exception handler   *   * @param env the quercus environment   */  public static Value restore_exception_handler(Env env)  {    env.restoreExceptionHandler();    return BooleanValue.TRUE;  }  /**   * Triggers an error.   *   * @param env the quercus environment   * @param msg the error message   * @param code the error level   */  public static Value trigger_error(Env env,                                    String msg,                                    @Optional("E_USER_NOTICE") int code)  {    switch (code) {    case Env.E_USER_NOTICE:      env.error(Env.B_USER_NOTICE, "", msg);      return BooleanValue.TRUE;    case Env.E_USER_WARNING:      env.error(Env.B_USER_WARNING, "", msg);      return BooleanValue.TRUE;    case Env.E_USER_ERROR:      env.error(Env.B_USER_ERROR, "", msg);      return BooleanValue.TRUE;    default:      env.warning(L.l("'0x{0}' is an invalid error type",                      Integer.toHexString(code)));      return BooleanValue.FALSE;    }  }  /**   * Triggers an error.   *   * @param env the quercus environment   * @param msg the error message   * @param code the error level   */  public Value user_error(Env env,                          String msg,                          @Optional("E_USER_NOTICE") int code)  {    return trigger_error(env, msg, code);  }  static final IniDefinition INI_ERROR_REPORING    = _iniDefinitions.add("error_reporing", null, PHP_INI_ALL);  static final IniDefinition INI_DISPLAY_ERRORS    = _iniDefinitions.add("display_errors", "1", PHP_INI_ALL);  static final IniDefinition INI_DISPLAY_STARTUP_ERRORS    = _iniDefinitions.add("display_startup_errors", false, PHP_INI_ALL);  static final IniDefinition INI_LOG_ERRORS    = _iniDefinitions.add("log_errors", false, PHP_INI_ALL);  static final IniDefinition INI_LOG_ERRORS_MAX_LEN    = _iniDefinitions.add("log_errors_max_len", 1024, PHP_INI_ALL);  static final IniDefinition INI_IGNORE_REPEATED_ERRORS    = _iniDefinitions.add("ignore_repeated_errors", false, PHP_INI_ALL);  static final IniDefinition INI_IGNORE_REPEATED_SOURCE    = _iniDefinitions.add("ignore_repeated_source", false, PHP_INI_ALL);  static final IniDefinition INI_REPORT_MEMLEAKS    = _iniDefinitions.add("report_memleaks", true, PHP_INI_ALL);  static final IniDefinition INI_TRACK_ERRORS    = _iniDefinitions.add("track_errors", false, PHP_INI_ALL);  static final IniDefinition INI_HTML_ERRORS    = _iniDefinitions.add("html_errors", true, PHP_INI_ALL);  static final IniDefinition INI_DOCREF_ROOT    = _iniDefinitions.add("docref_root", "", PHP_INI_ALL);  static final IniDefinition INI_DOCREF_EXT    = _iniDefinitions.add("docref_ext", "", PHP_INI_ALL);  static final IniDefinition INI_ERROR_PREPEND_STRING    = _iniDefinitions.add("error_prepend_string", null, PHP_INI_ALL);  static final IniDefinition INI_ERROR_APPEND_STRING    = _iniDefinitions.add("error_append_string", null, PHP_INI_ALL);  static final IniDefinition INI_ERROR_LOG    = _iniDefinitions.add("error_log", null, PHP_INI_ALL);  static final IniDefinition INI_WARN_PLUS_OVERLOADING    = _iniDefinitions.add("warn_plus_overloading", null, PHP_INI_ALL);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?