Exemplo n.º 1
0
  void moduleInit() override {
    HHVM_RC_INT_SAME(PAGELET_NOT_READY);
    HHVM_RC_INT_SAME(PAGELET_READY);
    HHVM_RC_INT_SAME(PAGELET_DONE);

    HHVM_FE(hphp_thread_type);
    HHVM_FE(pagelet_server_is_enabled);
    HHVM_FE(pagelet_server_task_start);
    HHVM_FE(pagelet_server_task_status);
    HHVM_FE(pagelet_server_task_result);
    HHVM_FE(pagelet_server_tasks_started);
    HHVM_FE(pagelet_server_flush);
    HHVM_FE(xbox_send_message);
    HHVM_FE(xbox_post_message);
    HHVM_FE(xbox_task_start);
    HHVM_FE(xbox_task_status);
    HHVM_FE(xbox_task_result);
    HHVM_FE(xbox_process_call_message);
    HHVM_FE(xbox_get_thread_timeout);
    HHVM_FE(xbox_set_thread_timeout);
    HHVM_FE(xbox_schedule_thread_reset);
    HHVM_FE(xbox_get_thread_time);
    HHVM_FALIAS(HH\\server_is_stopping, server_is_stopping);
    HHVM_FALIAS(HH\\server_is_prepared_to_stop, server_is_prepared_to_stop);
    HHVM_FALIAS(HH\\server_health_level, server_health_level);
    HHVM_FALIAS(HH\\server_uptime, server_uptime);
    HHVM_FALIAS(HH\\server_process_start_time, server_process_start_time);

    loadSystemlib();
  }
Exemplo n.º 2
0
  void moduleInit() override {
    HHVM_RC_INT_SAME(PAGELET_NOT_READY);
    HHVM_RC_INT_SAME(PAGELET_READY);
    HHVM_RC_INT_SAME(PAGELET_DONE);

    HHVM_FE(hphp_thread_type);
    HHVM_FE(dangling_server_proxy_old_request);
    HHVM_FE(pagelet_server_is_enabled);
    HHVM_FE(pagelet_server_task_start);
    HHVM_FE(pagelet_server_task_status);
    HHVM_FE(pagelet_server_task_result);
    HHVM_FE(pagelet_server_tasks_started);
    HHVM_FE(pagelet_server_flush);
    HHVM_FE(xbox_send_message);
    HHVM_FE(xbox_post_message);
    HHVM_FE(xbox_task_start);
    HHVM_FE(xbox_task_status);
    HHVM_FE(xbox_task_result);
    HHVM_FE(xbox_process_call_message);
    HHVM_FE(xbox_get_thread_timeout);
    HHVM_FE(xbox_set_thread_timeout);
    HHVM_FE(xbox_schedule_thread_reset);
    HHVM_FE(xbox_get_thread_time);
    HHVM_FE(server_is_stopping);
    HHVM_FE(server_uptime);

    loadSystemlib();
  }
Exemplo n.º 3
0
    void moduleInit() override {
      xsltSetGenericErrorFunc(nullptr, xslt_ext_error_handler);
      exsltRegisterAll();
      HHVM_RC_INT(XSL_SECPREF_NONE, k_XSL_SECPREF_NONE);
      HHVM_RC_INT(XSL_SECPREF_READ_FILE, k_XSL_SECPREF_READ_FILE);
      HHVM_RC_INT(XSL_SECPREF_WRITE_FILE, k_XSL_SECPREF_WRITE_FILE);
      HHVM_RC_INT(XSL_SECPREF_CREATE_DIRECTORY, k_XSL_SECPREF_CREATE_DIRECTORY);
      HHVM_RC_INT(XSL_SECPREF_READ_NETWORK, k_XSL_SECPREF_READ_NETWORK);
      HHVM_RC_INT(XSL_SECPREF_WRITE_NETWORK, k_XSL_SECPREF_WRITE_NETWORK);
      HHVM_RC_INT(XSL_SECPREF_DEFAULT, k_XSL_SECPREF_DEFAULT);

      HHVM_RC_INT_SAME(LIBXSLT_VERSION);
      HHVM_RC_STR_SAME(LIBXSLT_DOTTED_VERSION);

      HHVM_ME(XSLTProcessor, getParameter);
      HHVM_ME(XSLTProcessor, getSecurityPrefs);
      HHVM_ME(XSLTProcessor, importStylesheet);
      HHVM_ME(XSLTProcessor, removeParameter);
      HHVM_ME(XSLTProcessor, registerPHPFunctions);
      HHVM_ME(XSLTProcessor, setParameter);
      HHVM_ME(XSLTProcessor, setSecurityPrefs);
      HHVM_ME(XSLTProcessor, setProfiling);
      HHVM_ME(XSLTProcessor, transformToDoc);
      HHVM_ME(XSLTProcessor, transformToURI);
      HHVM_ME(XSLTProcessor, transformToXML);

      Native::
        registerNativeDataInfo<XSLTProcessorData>(s_XSLTProcessorData.get());

      loadSystemlib();
    }
Exemplo n.º 4
0
void StandardExtension::initVariable() {
  HHVM_RC_INT_SAME(EXTR_IF_EXISTS);
  HHVM_RC_INT_SAME(EXTR_OVERWRITE);
  HHVM_RC_INT_SAME(EXTR_PREFIX_ALL);
  HHVM_RC_INT_SAME(EXTR_PREFIX_IF_EXISTS);
  HHVM_RC_INT_SAME(EXTR_PREFIX_INVALID);
  HHVM_RC_INT_SAME(EXTR_PREFIX_SAME);
  HHVM_RC_INT_SAME(EXTR_REFS);
  HHVM_RC_INT_SAME(EXTR_SKIP);

  HHVM_FE(is_null);
  HHVM_FE(is_bool);
  HHVM_FE(is_int);
  HHVM_FALIAS(is_integer, is_int);
  HHVM_FALIAS(is_long, is_int);
  HHVM_FE(is_float);
  HHVM_FALIAS(is_double, is_float);
  HHVM_FALIAS(is_real, is_float);
  HHVM_FE(is_numeric);
  HHVM_FE(is_string);
  HHVM_FE(is_scalar);
  HHVM_FE(is_array);
  HHVM_FALIAS(HH\\is_vec, HH_is_vec);
  HHVM_FALIAS(HH\\is_dict, HH_is_dict);
  HHVM_FALIAS(HH\\is_keyset, HH_is_keyset);
  HHVM_FE(is_object);
  HHVM_FE(is_resource);
  HHVM_FE(boolval);
  HHVM_FE(intval);
  HHVM_FE(floatval);
  HHVM_FALIAS(doubleval, floatval);
  HHVM_FE(strval);
  HHVM_FE(gettype);
  HHVM_FE(get_resource_type);
  HHVM_FE(settype);
  HHVM_FE(print_r);
  HHVM_FE(var_export);
  HHVM_FE(debug_zval_dump);
  HHVM_FE(var_dump);
  HHVM_FE(serialize);
  HHVM_FE(unserialize);
  HHVM_FE(get_defined_vars);
  HHVM_FALIAS(__SystemLib\\get_defined_vars, SystemLib_get_defined_vars);
  HHVM_FE(extract);
  HHVM_FE(parse_str);
  HHVM_FALIAS(__SystemLib\\extract, SystemLib_extract);
  HHVM_FALIAS(__SystemLib\\parse_str, SystemLib_parse_str);

  loadSystemlib("std_variable");
}
Exemplo n.º 5
0
void StandardExtension::initMisc() {
    HHVM_FALIAS(HH\\server_warmup_status, server_warmup_status);
    HHVM_FE(connection_aborted);
    HHVM_FE(connection_status);
    HHVM_FE(connection_timeout);
    HHVM_FE(constant);
    HHVM_FE(define);
    HHVM_FE(defined);
    HHVM_FE(ignore_user_abort);
    HHVM_FE(pack);
    HHVM_FE(sleep);
    HHVM_FE(usleep);
    HHVM_FE(time_nanosleep);
    HHVM_FE(time_sleep_until);
    HHVM_FE(uniqid);
    HHVM_FE(unpack);
    HHVM_FE(sys_getloadavg);
    HHVM_FE(token_get_all);
    HHVM_FE(token_name);
    HHVM_FE(hphp_to_string);
    HHVM_FALIAS(__SystemLib\\max2, SystemLib_max2);
    HHVM_FALIAS(__SystemLib\\min2, SystemLib_min2);
    HHVM_RC_INT(PHP_MAXPATHLEN, PATH_MAX);
    Native::registerConstant<KindOfBoolean>(makeStaticString("PHP_DEBUG"),
      #if DEBUG
        true
      #else
        false
      #endif
     );
    bindTokenConstants();
    HHVM_RC_INT(T_PAAMAYIM_NEKUDOTAYIM, get_user_token_id(T_DOUBLE_COLON));

    HHVM_RC_INT(UPLOAD_ERR_OK,         0);
    HHVM_RC_INT(UPLOAD_ERR_INI_SIZE,   1);
    HHVM_RC_INT(UPLOAD_ERR_FORM_SIZE,  2);
    HHVM_RC_INT(UPLOAD_ERR_PARTIAL,    3);
    HHVM_RC_INT(UPLOAD_ERR_NO_FILE,    4);
    HHVM_RC_INT(UPLOAD_ERR_NO_TMP_DIR, 6);
    HHVM_RC_INT(UPLOAD_ERR_CANT_WRITE, 7);
    HHVM_RC_INT(UPLOAD_ERR_EXTENSION,  8);

    HHVM_RC_INT(CREDITS_GROUP,    1 << 0);
    HHVM_RC_INT(CREDITS_GENERAL,  1 << 1);
    HHVM_RC_INT(CREDITS_SAPI,     1 << 2);
    HHVM_RC_INT(CREDITS_MODULES,  1 << 3);
    HHVM_RC_INT(CREDITS_DOCS,     1 << 4);
    HHVM_RC_INT(CREDITS_FULLPAGE, 1 << 5);
    HHVM_RC_INT(CREDITS_QA,       1 << 6);
    HHVM_RC_INT(CREDITS_ALL, 0xFFFFFFFF);

    HHVM_RC_INT(INI_SYSTEM, IniSetting::PHP_INI_SYSTEM);
    HHVM_RC_INT(INI_PERDIR, IniSetting::PHP_INI_PERDIR);
    HHVM_RC_INT(INI_USER,   IniSetting::PHP_INI_USER);
    HHVM_RC_INT(INI_ALL,    IniSetting::PHP_INI_SYSTEM |
                            IniSetting::PHP_INI_PERDIR |
                            IniSetting::PHP_INI_USER);

    HHVM_RC_STR(PHP_BINARY, current_executable_path());
    HHVM_RC_STR(PHP_BINDIR, current_executable_directory());
    HHVM_RC_STR(PHP_OS, HHVM_FN(php_uname)("s").toString().toCppString());
    HHVM_RC_STR(PHP_SAPI, RuntimeOption::ExecutionMode);

    HHVM_RC_INT(PHP_INT_SIZE, sizeof(int64_t));
    HHVM_RC_INT(PHP_INT_MIN, k_PHP_INT_MIN);
    HHVM_RC_INT(PHP_INT_MAX, k_PHP_INT_MAX);

    HHVM_RC_INT_SAME(PHP_MAJOR_VERSION);
    HHVM_RC_INT_SAME(PHP_MINOR_VERSION);
    HHVM_RC_INT_SAME(PHP_RELEASE_VERSION);
    HHVM_RC_STR_SAME(PHP_EXTRA_VERSION);
    HHVM_RC_STR_SAME(PHP_VERSION);
    HHVM_RC_INT_SAME(PHP_VERSION_ID);

    // FIXME: These values are hardcoded from their previous IDL values
    // Grab their correct values from the system as appropriate
    HHVM_RC_STR(PHP_EOL, "\n");
    HHVM_RC_STR(PHP_CONFIG_FILE_PATH, "");
    HHVM_RC_STR(PHP_CONFIG_FILE_SCAN_DIR, "");
    HHVM_RC_STR(PHP_DATADIR, "");
    HHVM_RC_STR(PHP_EXTENSION_DIR, "");
    HHVM_RC_STR(PHP_LIBDIR, "");
    HHVM_RC_STR(PHP_LOCALSTATEDIR, "");
    HHVM_RC_STR(PHP_PREFIX, "");
    HHVM_RC_STR(PHP_SHLIB_SUFFIX, "so");
    HHVM_RC_STR(PHP_SYSCONFDIR, "");
    HHVM_RC_STR(PEAR_EXTENSION_DIR, "");
    HHVM_RC_STR(PEAR_INSTALL_DIR, "");

    loadSystemlib("std_misc");
  }
Exemplo n.º 6
0
void StandardExtension::initNetwork() {
  HHVM_FE(gethostname);
  HHVM_FE(gethostbyaddr);
  HHVM_FE(gethostbyname);
  HHVM_FE(gethostbynamel);
  HHVM_FE(getprotobyname);
  HHVM_FE(getprotobynumber);
  HHVM_FE(getservbyname);
  HHVM_FE(getservbyport);
  HHVM_FE(inet_ntop);
  HHVM_FE(inet_pton);
  HHVM_FE(ip2long);
  HHVM_FE(long2ip);
  HHVM_FE(checkdnsrr);
  HHVM_FE(dns_get_record);
  HHVM_FE(getmxrr);
  HHVM_FE(header);
  HHVM_FE(http_response_code);
  HHVM_FE(headers_list);
  HHVM_FE(headers_sent);
  HHVM_FE(header_register_callback);
  HHVM_FE(header_remove);
  HHVM_FE(get_http_request_size);
  HHVM_FE(setcookie);
  HHVM_FE(setrawcookie);
  HHVM_FE(openlog);
  HHVM_FE(closelog);
  HHVM_FE(syslog);

  // These are defined in ext_socket, but Zend has them in network
  HHVM_FE(fsockopen);
  HHVM_FE(pfsockopen);

#define PHP_DNS_RC_INT(cns) Native::registerConstant<KindOfInt64> \
  (makeStaticString("DNS_" #cns), PHP_DNS_ ## cns);
  PHP_DNS_RC_INT(A);
  PHP_DNS_RC_INT(A6);
  PHP_DNS_RC_INT(AAAA);
  PHP_DNS_RC_INT(ALL);
  PHP_DNS_RC_INT(ANY);
  PHP_DNS_RC_INT(CNAME);
  PHP_DNS_RC_INT(HINFO);
  PHP_DNS_RC_INT(MX);
  PHP_DNS_RC_INT(NAPTR);
  PHP_DNS_RC_INT(NS);
  PHP_DNS_RC_INT(PTR);
  PHP_DNS_RC_INT(SOA);
  PHP_DNS_RC_INT(SRV);
  PHP_DNS_RC_INT(TXT);
#undef PHP_DNS_RC_INT

  HHVM_RC_INT_SAME(LOG_EMERG);
  HHVM_RC_INT_SAME(LOG_ALERT);
  HHVM_RC_INT_SAME(LOG_CRIT);
  HHVM_RC_INT_SAME(LOG_ERR);
  HHVM_RC_INT_SAME(LOG_WARNING);
  HHVM_RC_INT_SAME(LOG_NOTICE);
  HHVM_RC_INT_SAME(LOG_INFO);
  HHVM_RC_INT_SAME(LOG_DEBUG);

#ifdef LOG_KERN
   HHVM_RC_INT_SAME(LOG_KERN);
#endif
#ifdef LOG_USER
   HHVM_RC_INT_SAME(LOG_USER);
#endif
#ifdef LOG_MAIL
   HHVM_RC_INT_SAME(LOG_MAIL);
#endif
#ifdef LOG_DAEMON
   HHVM_RC_INT_SAME(LOG_DAEMON);
#endif
#ifdef LOG_AUTH
   HHVM_RC_INT_SAME(LOG_AUTH);
#endif
#ifdef LOG_SYSLOG
   HHVM_RC_INT_SAME(LOG_SYSLOG);
#endif
#ifdef LOG_LPR
   HHVM_RC_INT_SAME(LOG_LPR);
#endif
#ifdef LOG_PID
   HHVM_RC_INT_SAME(LOG_PID);
#endif
#ifdef LOG_CONS
   HHVM_RC_INT_SAME(LOG_CONS);
#endif
#ifdef LOG_ODELAY
   HHVM_RC_INT_SAME(LOG_ODELAY);
#endif
#ifdef LOG_NDELAY
   HHVM_RC_INT_SAME(LOG_NDELAY);
#endif
#ifdef LOG_NEWS
  HHVM_RC_INT_SAME(LOG_NEWS);
#endif
#ifdef LOG_UUCP
  HHVM_RC_INT_SAME(LOG_UUCP);
#endif
#ifdef LOG_CRON
  HHVM_RC_INT_SAME(LOG_CRON);
#endif
#ifdef LOG_AUTHPRIV
  HHVM_RC_INT_SAME(LOG_AUTHPRIV);
#endif
#ifdef LOG_NOWAIT
  HHVM_RC_INT_SAME(LOG_NOWAIT);
#endif
#ifdef LOG_PERROR
  HHVM_RC_INT_SAME(LOG_PERROR);
#endif

#ifndef _WIN32
  HHVM_RC_INT_SAME(LOG_LOCAL0);
  HHVM_RC_INT_SAME(LOG_LOCAL1);
  HHVM_RC_INT_SAME(LOG_LOCAL2);
  HHVM_RC_INT_SAME(LOG_LOCAL3);
  HHVM_RC_INT_SAME(LOG_LOCAL4);
  HHVM_RC_INT_SAME(LOG_LOCAL5);
  HHVM_RC_INT_SAME(LOG_LOCAL6);
  HHVM_RC_INT_SAME(LOG_LOCAL7);
#endif

  loadSystemlib("std_network");
}
Exemplo n.º 7
0
int64_t HHVM_FUNCTION(rand,
                      int64_t min /* = 0 */,
                      const Variant& max /* = null_variant */) {
#if defined(__APPLE__) || defined(_MSC_VER)
  if (!s_rand_is_seeded) {
#else
  if (s_state.state != RandomBuf::RequestInit) {
#endif
    randinit(math_generate_seed());
  }

  int64_t number;
#ifdef __APPLE__
  number = random();
#elif defined(_MSC_VER)
  number = rand();
#else
  int32_t numberIn;
  random_r(&s_state.data, &numberIn);
  number = numberIn;
#endif
  int64_t int_max = max.isNull() ? RAND_MAX : max.toInt64();
  if (min != 0 || int_max != RAND_MAX) {
    RAND_RANGE(number, min, int_max, RAND_MAX);
  }
  return number;
}

int64_t HHVM_FUNCTION(mt_getrandmax) { return MT_RAND_MAX;}

void HHVM_FUNCTION(mt_srand,
                   const Variant& seed /* = null_variant */) {
  if (seed.isNull()) {
    return math_mt_srand(math_generate_seed());
  }
  if (seed.isNumeric(true)) {
    math_mt_srand(seed.toInt32());
  } else {
    raise_warning("mt_srand() expects parameter 1 to be long");
  }
}

int64_t HHVM_FUNCTION(mt_rand,
                      int64_t min /* = 0 */,
                      const Variant& max /* = null_variant */) {
  return math_mt_rand(min, max.isNull() ? RAND_MAX : max.toInt64());
}

double HHVM_FUNCTION(lcg_value) { return math_combined_lcg();}

Variant HHVM_FUNCTION(intdiv, int64_t numerator, int64_t divisor) {
  if (divisor == 0) {
    SystemLib::throwDivisionByZeroErrorObject(Strings::DIVISION_BY_ZERO);
  } else if (divisor == -1 &&
             numerator == std::numeric_limits<int64_t>::min()) {
    SystemLib::throwArithmeticErrorObject(
      "Division of PHP_INT_MIN by -1 is not an integer");
  }
  return numerator/divisor;
}

///////////////////////////////////////////////////////////////////////////////

void StandardExtension::requestInitMath() {
#if !defined(__APPLE__) && !defined(_MSC_VER)
  if (s_state.state == RandomBuf::RequestInit) {
    s_state.state = RandomBuf::ThreadInit;
  }
#endif
}

#define DCONST(nm)                                                       \
  Native::registerConstant<KindOfDouble>(makeStaticString(#nm), k_##nm)  \

void StandardExtension::initMath() {
  HHVM_RC_INT_SAME(PHP_ROUND_HALF_UP);
  HHVM_RC_INT_SAME(PHP_ROUND_HALF_DOWN);
  HHVM_RC_INT_SAME(PHP_ROUND_HALF_EVEN);
  HHVM_RC_INT_SAME(PHP_ROUND_HALF_ODD);

  DCONST(M_PI);
  DCONST(M_1_PI);
  DCONST(M_2_PI);
  DCONST(M_2_SQRTPI);
  DCONST(M_E);
  DCONST(M_EULER);
  DCONST(M_LN10);
  DCONST(M_LN2);
  DCONST(M_LNPI);
  DCONST(M_LOG10E);
  DCONST(M_LOG2E);
  DCONST(M_PI_2);
  DCONST(M_PI_4);
  DCONST(M_SQRT1_2);
  DCONST(M_SQRT2);
  DCONST(M_SQRT3);
  DCONST(M_SQRTPI);

  HHVM_FE(min);
  HHVM_FE(max);
  HHVM_FE(abs);
  HHVM_FE(is_finite);
  HHVM_FE(is_infinite);
  HHVM_FE(is_nan);
  HHVM_FE(ceil);
  HHVM_FE(floor);
  HHVM_FE(round);
  HHVM_FE(deg2rad);
  HHVM_FE(rad2deg);
  HHVM_FE(decbin);
  HHVM_FE(dechex);
  HHVM_FE(decoct);
  HHVM_FE(bindec);
  HHVM_FE(hexdec);
  HHVM_FE(octdec);
  HHVM_FE(base_convert);
  HHVM_FE(pow);
  HHVM_FE(exp);
  HHVM_FE(expm1);
  HHVM_FE(log10);
  HHVM_FE(log1p);
  HHVM_FE(log);
  HHVM_FE(cos);
  HHVM_FE(cosh);
  HHVM_FE(sin);
  HHVM_FE(sinh);
  HHVM_FE(tan);
  HHVM_FE(tanh);
  HHVM_FE(acos);
  HHVM_FE(acosh);
  HHVM_FE(asin);
  HHVM_FE(asinh);
  HHVM_FE(atan);
  HHVM_FE(atanh);
  HHVM_FE(atan2);
  HHVM_FE(hypot);
  HHVM_FE(fmod);
  HHVM_FE(sqrt);
  HHVM_FE(getrandmax);
  HHVM_FE(srand);
  HHVM_FE(rand);
  HHVM_FE(mt_getrandmax);
  HHVM_FE(mt_srand);
  HHVM_FE(mt_rand);
  HHVM_FE(lcg_value);
  HHVM_FE(intdiv);

  loadSystemlib("std_math");
}
Exemplo n.º 8
0
void StandardExtension::initMisc() {
    HHVM_FALIAS(HH\\server_warmup_status, server_warmup_status);
    HHVM_FE(connection_aborted);
    HHVM_FE(connection_status);
    HHVM_FE(connection_timeout);
    HHVM_FE(constant);
    HHVM_FE(define);
    HHVM_FE(defined);
    HHVM_FE(ignore_user_abort);
    HHVM_FE(pack);
    HHVM_FE(sleep);
    HHVM_FE(usleep);
    HHVM_FE(time_nanosleep);
    HHVM_FE(time_sleep_until);
    HHVM_FE(uniqid);
    HHVM_FE(unpack);
    HHVM_FE(sys_getloadavg);
    HHVM_FE(token_get_all);
    HHVM_FE(token_name);
    HHVM_FE(hphp_to_string);
    HHVM_FALIAS(__SystemLib\\max2, SystemLib_max2);
    HHVM_FALIAS(__SystemLib\\min2, SystemLib_min2);
    Native::registerConstant<KindOfDouble>(makeStaticString("INF"), k_INF);
    Native::registerConstant<KindOfDouble>(makeStaticString("NAN"), k_NAN);
    Native::registerConstant<KindOfInt64>(
        makeStaticString("PHP_MAXPATHLEN"), MAXPATHLEN);
    Native::registerConstant<KindOfBoolean>(makeStaticString("PHP_DEBUG"),
      #if DEBUG
        true
      #else
        false
      #endif
     );
    bindTokenConstants();
    Native::registerConstant<KindOfInt64>(s_T_PAAMAYIM_NEKUDOTAYIM.get(),
                                          get_user_token_id(T_DOUBLE_COLON));

    HHVM_RC_STR(PHP_BINARY, current_executable_path());
    HHVM_RC_STR(PHP_BINDIR, current_executable_directory());
    HHVM_RC_STR(PHP_OS, HHVM_FN(php_uname)("s").toString().toCppString());
    HHVM_RC_STR(PHP_SAPI, RuntimeOption::ExecutionMode);

    HHVM_RC_INT(PHP_INT_SIZE, sizeof(int64_t));
    HHVM_RC_INT(PHP_INT_MIN, k_PHP_INT_MIN);
    HHVM_RC_INT(PHP_INT_MAX, k_PHP_INT_MAX);

    HHVM_RC_INT_SAME(PHP_MAJOR_VERSION);
    HHVM_RC_INT_SAME(PHP_MINOR_VERSION);
    HHVM_RC_INT_SAME(PHP_RELEASE_VERSION);
    HHVM_RC_STR_SAME(PHP_EXTRA_VERSION);
    HHVM_RC_STR_SAME(PHP_VERSION);
    HHVM_RC_INT_SAME(PHP_VERSION_ID);

    // FIXME: These values are hardcoded from their previous IDL values
    // Grab their correct values from the system as appropriate
    HHVM_RC_STR(PHP_EOL, "\n");
    HHVM_RC_STR(PHP_CONFIG_FILE_PATH, "");
    HHVM_RC_STR(PHP_CONFIG_FILE_SCAN_DIR, "");
    HHVM_RC_STR(PHP_DATADIR, "");
    HHVM_RC_STR(PHP_EXTENSION_DIR, "");
    HHVM_RC_STR(PHP_LIBDIR, "");
    HHVM_RC_STR(PHP_LOCALSTATEDIR, "");
    HHVM_RC_STR(PHP_PREFIX, "");
    HHVM_RC_STR(PHP_SHLIB_SUFFIX, "so");
    HHVM_RC_STR(PHP_SYSCONFDIR, "");
    HHVM_RC_STR(PEAR_EXTENSION_DIR, "");
    HHVM_RC_STR(PEAR_INSTALL_DIR, "");

    loadSystemlib("std_misc");
  }
Exemplo n.º 9
0
    void moduleInit() override {
      HHVM_RC_INT_SAME(LIBXML_VERSION);
      HHVM_RC_STR_SAME(LIBXML_DOTTED_VERSION);
      HHVM_RC_STR(LIBXML_LOADED_VERSION, xmlParserVersion);

      // For use with loading xml
      HHVM_RC_INT(LIBXML_NOENT, XML_PARSE_NOENT);
      HHVM_RC_INT(LIBXML_DTDLOAD, XML_PARSE_DTDLOAD);
      HHVM_RC_INT(LIBXML_DTDATTR, XML_PARSE_DTDATTR);
      HHVM_RC_INT(LIBXML_DTDVALID, XML_PARSE_DTDVALID);
      HHVM_RC_INT(LIBXML_NOERROR, XML_PARSE_NOERROR);
      HHVM_RC_INT(LIBXML_NOWARNING, XML_PARSE_NOWARNING);
      HHVM_RC_INT(LIBXML_NOBLANKS, XML_PARSE_NOBLANKS);
      HHVM_RC_INT(LIBXML_XINCLUDE, XML_PARSE_XINCLUDE);
      HHVM_RC_INT(LIBXML_NSCLEAN, XML_PARSE_NSCLEAN);
      HHVM_RC_INT(LIBXML_NOCDATA, XML_PARSE_NOCDATA);
      HHVM_RC_INT(LIBXML_NONET, XML_PARSE_NONET);
      HHVM_RC_INT(LIBXML_PEDANTIC, XML_PARSE_PEDANTIC);
      HHVM_RC_INT(LIBXML_COMPACT, XML_PARSE_COMPACT);
      HHVM_RC_INT(LIBXML_NOXMLDECL, XML_SAVE_NO_DECL);
      HHVM_RC_INT(LIBXML_PARSEHUGE, XML_PARSE_HUGE);
      HHVM_RC_INT(LIBXML_NOEMPTYTAG, LIBXML_SAVE_NOEMPTYTAG);

      // Schema validation options
#if defined(LIBXML_SCHEMAS_ENABLED)
      HHVM_RC_INT(LIBXML_SCHEMA_CREATE, XML_SCHEMA_VAL_VC_I_CREATE);
#endif

      // Additional constants for use with loading html
#if LIBXML_VERSION >= 20707
      HHVM_RC_INT(LIBXML_HTML_NOIMPLIED, HTML_PARSE_NOIMPLIED);
#endif

#if LIBXML_VERSION >= 20708
      HHVM_RC_INT(LIBXML_HTML_NODEFDTD, HTML_PARSE_NODEFDTD);
#endif

      // Error levels
      HHVM_RC_INT(LIBXML_ERR_NONE, XML_ERR_NONE);
      HHVM_RC_INT(LIBXML_ERR_WARNING, XML_ERR_WARNING);
      HHVM_RC_INT(LIBXML_ERR_ERROR, XML_ERR_ERROR);
      HHVM_RC_INT(LIBXML_ERR_FATAL, XML_ERR_FATAL);

      HHVM_FE(libxml_get_errors);
      HHVM_FE(libxml_get_last_error);
      HHVM_FE(libxml_clear_errors);
      HHVM_FE(libxml_use_internal_errors);
      HHVM_FE(libxml_suppress_errors);
      HHVM_FE(libxml_disable_entity_loader);
      HHVM_FE(libxml_set_streams_context);

      loadSystemlib();

      s_LibXMLError_class = Unit::lookupClass(s_LibXMLError.get());

      // Set up callbacks to support stream wrappers for reading and writing
      // xml files and loading external entities.
      xmlParserInputBufferCreateFilenameDefault(libxml_create_input_buffer);
      xmlOutputBufferCreateFilenameDefault(libxml_create_output_buffer);
      s_default_entity_loader = xmlGetExternalEntityLoader();
      xmlSetExternalEntityLoader(libxml_ext_entity_loader);
    }
Exemplo n.º 10
0
  void moduleInit() override {
    HHVM_RC_STR(PCRE_VERSION, pcre_version());

    HHVM_RC_INT(PREG_NO_ERROR, PHP_PCRE_NO_ERROR);
    HHVM_RC_INT(PREG_INTERNAL_ERROR, PHP_PCRE_INTERNAL_ERROR);
    HHVM_RC_INT(PREG_BACKTRACK_LIMIT_ERROR, PHP_PCRE_BACKTRACK_LIMIT_ERROR);
    HHVM_RC_INT(PREG_RECURSION_LIMIT_ERROR, PHP_PCRE_RECURSION_LIMIT_ERROR);
    HHVM_RC_INT(PREG_BAD_UTF8_ERROR, PHP_PCRE_BAD_UTF8_ERROR);
    HHVM_RC_INT(PREG_BAD_UTF8_OFFSET_ERROR, PHP_PCRE_BAD_UTF8_OFFSET_ERROR);

    HHVM_RC_INT_SAME(PREG_PATTERN_ORDER);
    HHVM_RC_INT_SAME(PREG_SET_ORDER);
    HHVM_RC_INT_SAME(PREG_OFFSET_CAPTURE);

    HHVM_RC_INT_SAME(PREG_SPLIT_NO_EMPTY);
    HHVM_RC_INT_SAME(PREG_SPLIT_DELIM_CAPTURE);
    HHVM_RC_INT_SAME(PREG_SPLIT_OFFSET_CAPTURE);

    HHVM_RC_INT_SAME(PREG_GREP_INVERT);

#ifdef WNOHANG
    HHVM_RC_INT_SAME(WNOHANG);
#endif
#ifdef WUNTRACED
    HHVM_RC_INT_SAME(WUNTRACED);
#endif

#ifdef PRIO_PGRP
    HHVM_RC_INT_SAME(PRIO_PGRP);
#endif
#ifdef PRIO_USER
    HHVM_RC_INT_SAME(PRIO_USER);
#endif
#ifdef PRIO_PROCESS
    HHVM_RC_INT_SAME(PRIO_PROCESS);
#endif

    HHVM_FE(preg_filter);
    HHVM_FE(preg_grep);
    HHVM_FE(preg_match);
    HHVM_FE(preg_match_all);
    HHVM_FE(preg_replace);
    HHVM_FE(preg_replace_callback);
    HHVM_FE(preg_replace_callback_array);
    HHVM_FE(preg_split);
    HHVM_FE(preg_quote);
    HHVM_FE(preg_last_error);
    HHVM_FE(ereg_replace);
    HHVM_FE(eregi_replace);
    HHVM_FE(ereg);
    HHVM_FE(eregi);
    HHVM_FE(split);
    HHVM_FE(spliti);
    HHVM_FE(sql_regcase);

    loadSystemlib();

    pcre_config(PCRE_CONFIG_JIT, &s_pcre_has_jit);
    IniSetting::Bind(this, IniSetting::PHP_INI_ONLY,
                     "hhvm.pcre.jit",
                     &s_pcre_has_jit);
  }
Exemplo n.º 11
0
Arquivo: icu.cpp Projeto: KOgames/hhvm
void IntlExtension::bindConstants() {
#ifdef U_ICU_DATA_VERSION
  HHVM_RC_STR(INTL_ICU_DATA_VERSION, U_ICU_DATA_VERSION);
#endif
  HHVM_RC_STR(INTL_ICU_VERSION, U_ICU_VERSION);

  // UErrorCode constants
  HHVM_RC_INT_SAME(U_AMBIGUOUS_ALIAS_WARNING);
  HHVM_RC_INT_SAME(U_BAD_VARIABLE_DEFINITION);
  HHVM_RC_INT_SAME(U_BRK_ASSIGN_ERROR);
  HHVM_RC_INT_SAME(U_BRK_ERROR_LIMIT);
  HHVM_RC_INT_SAME(U_BRK_ERROR_START);
  HHVM_RC_INT_SAME(U_BRK_HEX_DIGITS_EXPECTED);
  HHVM_RC_INT_SAME(U_BRK_INIT_ERROR);
  HHVM_RC_INT_SAME(U_BRK_INTERNAL_ERROR);
  HHVM_RC_INT_SAME(U_BRK_MALFORMED_RULE_TAG);
  HHVM_RC_INT_SAME(U_BRK_MISMATCHED_PAREN);
  HHVM_RC_INT_SAME(U_BRK_NEW_LINE_IN_QUOTED_STRING);
  HHVM_RC_INT_SAME(U_BRK_RULE_EMPTY_SET);
  HHVM_RC_INT_SAME(U_BRK_RULE_SYNTAX);
  HHVM_RC_INT_SAME(U_BRK_SEMICOLON_EXPECTED);
  HHVM_RC_INT_SAME(U_BRK_UNCLOSED_SET);
  HHVM_RC_INT_SAME(U_BRK_UNDEFINED_VARIABLE);
  HHVM_RC_INT_SAME(U_BRK_UNRECOGNIZED_OPTION);
  HHVM_RC_INT_SAME(U_BRK_VARIABLE_REDFINITION);
  HHVM_RC_INT_SAME(U_BUFFER_OVERFLOW_ERROR);
  HHVM_RC_INT_SAME(U_CE_NOT_FOUND_ERROR);
  HHVM_RC_INT_SAME(U_COLLATOR_VERSION_MISMATCH);
  HHVM_RC_INT_SAME(U_DIFFERENT_UCA_VERSION);
  HHVM_RC_INT_SAME(U_ENUM_OUT_OF_SYNC_ERROR);
  HHVM_RC_INT_SAME(U_ERROR_LIMIT);
  HHVM_RC_INT_SAME(U_ERROR_WARNING_LIMIT);
  HHVM_RC_INT_SAME(U_ERROR_WARNING_START);
  HHVM_RC_INT_SAME(U_FILE_ACCESS_ERROR);
  HHVM_RC_INT_SAME(U_FMT_PARSE_ERROR_LIMIT);
  HHVM_RC_INT_SAME(U_FMT_PARSE_ERROR_START);
  HHVM_RC_INT_SAME(U_ILLEGAL_ARGUMENT_ERROR);
  HHVM_RC_INT_SAME(U_ILLEGAL_CHARACTER);
  HHVM_RC_INT_SAME(U_ILLEGAL_CHAR_FOUND);
  HHVM_RC_INT_SAME(U_ILLEGAL_CHAR_IN_SEGMENT);
  HHVM_RC_INT_SAME(U_ILLEGAL_ESCAPE_SEQUENCE);
  HHVM_RC_INT_SAME(U_ILLEGAL_PAD_POSITION);
  HHVM_RC_INT_SAME(U_INDEX_OUTOFBOUNDS_ERROR);
  HHVM_RC_INT_SAME(U_INTERNAL_PROGRAM_ERROR);
  HHVM_RC_INT_SAME(U_INTERNAL_TRANSLITERATOR_ERROR);
  HHVM_RC_INT_SAME(U_INVALID_CHAR_FOUND);
  HHVM_RC_INT_SAME(U_INVALID_FORMAT_ERROR);
  HHVM_RC_INT_SAME(U_INVALID_FUNCTION);
  HHVM_RC_INT_SAME(U_INVALID_ID);
  HHVM_RC_INT_SAME(U_INVALID_PROPERTY_PATTERN);
  HHVM_RC_INT_SAME(U_INVALID_RBT_SYNTAX);
  HHVM_RC_INT_SAME(U_INVALID_STATE_ERROR);
  HHVM_RC_INT_SAME(U_INVALID_TABLE_FILE);
  HHVM_RC_INT_SAME(U_INVALID_TABLE_FORMAT);
  HHVM_RC_INT_SAME(U_INVARIANT_CONVERSION_ERROR);
  HHVM_RC_INT_SAME(U_MALFORMED_EXPONENTIAL_PATTERN);
  HHVM_RC_INT_SAME(U_MALFORMED_PRAGMA);
  HHVM_RC_INT_SAME(U_MALFORMED_RULE);
  HHVM_RC_INT_SAME(U_MALFORMED_SET);
  HHVM_RC_INT_SAME(U_MALFORMED_SYMBOL_REFERENCE);
  HHVM_RC_INT_SAME(U_MALFORMED_UNICODE_ESCAPE);
  HHVM_RC_INT_SAME(U_MALFORMED_VARIABLE_DEFINITION);
  HHVM_RC_INT_SAME(U_MALFORMED_VARIABLE_REFERENCE);
  HHVM_RC_INT_SAME(U_MEMORY_ALLOCATION_ERROR);
  HHVM_RC_INT_SAME(U_MESSAGE_PARSE_ERROR);
  HHVM_RC_INT_SAME(U_MISMATCHED_SEGMENT_DELIMITERS);
  HHVM_RC_INT_SAME(U_MISPLACED_ANCHOR_START);
  HHVM_RC_INT_SAME(U_MISPLACED_COMPOUND_FILTER);
  HHVM_RC_INT_SAME(U_MISPLACED_CURSOR_OFFSET);
  HHVM_RC_INT_SAME(U_MISPLACED_QUANTIFIER);
  HHVM_RC_INT_SAME(U_MISSING_OPERATOR);
  HHVM_RC_INT_SAME(U_MISSING_RESOURCE_ERROR);
  HHVM_RC_INT_SAME(U_MISSING_SEGMENT_CLOSE);
  HHVM_RC_INT_SAME(U_MULTIPLE_ANTE_CONTEXTS);
  HHVM_RC_INT_SAME(U_MULTIPLE_COMPOUND_FILTERS);
  HHVM_RC_INT_SAME(U_MULTIPLE_CURSORS);
  HHVM_RC_INT_SAME(U_MULTIPLE_EXPONENTIAL_SYMBOLS);
  HHVM_RC_INT_SAME(U_MULTIPLE_PAD_SPECIFIERS);
  HHVM_RC_INT_SAME(U_MULTIPLE_PERCENT_SYMBOLS);
  HHVM_RC_INT_SAME(U_MULTIPLE_PERMILL_SYMBOLS);
  HHVM_RC_INT_SAME(U_MULTIPLE_POST_CONTEXTS);
  HHVM_RC_INT_SAME(U_NO_SPACE_AVAILABLE);
  HHVM_RC_INT_SAME(U_NO_WRITE_PERMISSION);
  HHVM_RC_INT_SAME(U_PARSE_ERROR);
  HHVM_RC_INT_SAME(U_PARSE_ERROR_LIMIT);
  HHVM_RC_INT_SAME(U_PARSE_ERROR_START);
  HHVM_RC_INT_SAME(U_PATTERN_SYNTAX_ERROR);
  HHVM_RC_INT_SAME(U_PRIMARY_TOO_LONG_ERROR);
  HHVM_RC_INT_SAME(U_REGEX_BAD_ESCAPE_SEQUENCE);
  HHVM_RC_INT_SAME(U_REGEX_BAD_INTERVAL);
  HHVM_RC_INT_SAME(U_REGEX_ERROR_LIMIT);
  HHVM_RC_INT_SAME(U_REGEX_ERROR_START);
  HHVM_RC_INT_SAME(U_REGEX_INTERNAL_ERROR);
  HHVM_RC_INT_SAME(U_REGEX_INVALID_BACK_REF);
  HHVM_RC_INT_SAME(U_REGEX_INVALID_FLAG);
  HHVM_RC_INT_SAME(U_REGEX_INVALID_STATE);
  HHVM_RC_INT_SAME(U_REGEX_LOOK_BEHIND_LIMIT);
  HHVM_RC_INT_SAME(U_REGEX_MAX_LT_MIN);
  HHVM_RC_INT_SAME(U_REGEX_MISMATCHED_PAREN);
  HHVM_RC_INT_SAME(U_REGEX_NUMBER_TOO_BIG);
  HHVM_RC_INT_SAME(U_REGEX_PROPERTY_SYNTAX);
  HHVM_RC_INT_SAME(U_REGEX_RULE_SYNTAX);
  HHVM_RC_INT_SAME(U_REGEX_SET_CONTAINS_STRING);
  HHVM_RC_INT_SAME(U_REGEX_UNIMPLEMENTED);
  HHVM_RC_INT_SAME(U_RESOURCE_TYPE_MISMATCH);
  HHVM_RC_INT_SAME(U_RULE_MASK_ERROR);
  HHVM_RC_INT_SAME(U_SAFECLONE_ALLOCATED_WARNING);
  HHVM_RC_INT_SAME(U_SORT_KEY_TOO_SHORT_WARNING);
  HHVM_RC_INT_SAME(U_STANDARD_ERROR_LIMIT);
  HHVM_RC_INT_SAME(U_STATE_OLD_WARNING);
  HHVM_RC_INT_SAME(U_STATE_TOO_OLD_ERROR);
  HHVM_RC_INT_SAME(U_STRING_NOT_TERMINATED_WARNING);
  HHVM_RC_INT_SAME(U_TOO_MANY_ALIASES_ERROR);
  HHVM_RC_INT_SAME(U_TRAILING_BACKSLASH);
  HHVM_RC_INT_SAME(U_TRUNCATED_CHAR_FOUND);
  HHVM_RC_INT_SAME(U_UNCLOSED_SEGMENT);
  HHVM_RC_INT_SAME(U_UNDEFINED_SEGMENT_REFERENCE);
  HHVM_RC_INT_SAME(U_UNDEFINED_VARIABLE);
  HHVM_RC_INT_SAME(U_UNEXPECTED_TOKEN);
  HHVM_RC_INT_SAME(U_UNMATCHED_BRACES);
  HHVM_RC_INT_SAME(U_UNQUOTED_SPECIAL);
  HHVM_RC_INT_SAME(U_UNSUPPORTED_ATTRIBUTE);
  HHVM_RC_INT_SAME(U_UNSUPPORTED_ERROR);
  HHVM_RC_INT_SAME(U_UNSUPPORTED_ESCAPE_SEQUENCE);
  HHVM_RC_INT_SAME(U_UNSUPPORTED_PROPERTY);
  HHVM_RC_INT_SAME(U_UNTERMINATED_QUOTE);
  HHVM_RC_INT_SAME(U_USELESS_COLLATOR_ERROR);
  HHVM_RC_INT_SAME(U_USING_DEFAULT_WARNING);
  HHVM_RC_INT_SAME(U_USING_FALLBACK_WARNING);
  HHVM_RC_INT_SAME(U_VARIABLE_RANGE_EXHAUSTED);
  HHVM_RC_INT_SAME(U_VARIABLE_RANGE_OVERLAP);
  HHVM_RC_INT_SAME(U_ZERO_ERROR);

  // Legacy constants
#ifndef U_STRINGPREP_PROHIBITED_ERROR
# define U_STRINGPREP_PROHIBITED_ERROR 66560
#endif
#ifndef U_STRINGPREP_UNASSIGNED_ERROR
# define U_STRINGPREP_UNASSIGNED_ERROR 66561
#endif
#ifndef U_STRINGPREP_CHECK_BIDI_ERROR
# define U_STRINGPREP_CHECK_BIDI_ERROR 66562
#endif
  HHVM_RC_INT_SAME(U_STRINGPREP_PROHIBITED_ERROR);
  HHVM_RC_INT_SAME(U_STRINGPREP_UNASSIGNED_ERROR);
  HHVM_RC_INT_SAME(U_STRINGPREP_CHECK_BIDI_ERROR);
}
Exemplo n.º 12
0
  void moduleInit() override {
    HHVM_FE(pcntl_alarm);
    HHVM_FE(pcntl_exec);
    HHVM_FE(pcntl_fork);
    HHVM_FE(pcntl_getpriority);
    HHVM_FE(pcntl_setpriority);
    HHVM_FE(pcntl_signal);
    HHVM_FE(pcntl_sigprocmask);
    HHVM_FE(pcntl_wait);
    HHVM_FE(pcntl_waitpid);
    HHVM_FE(pcntl_wexitstatus);
    HHVM_FE(pcntl_signal_dispatch);
    HHVM_FE(pcntl_wifexited);
    HHVM_FE(pcntl_wifsignaled);
    HHVM_FE(pcntl_wifstopped);
    HHVM_FE(pcntl_wstopsig);
    HHVM_FE(pcntl_wtermsig);

    HHVM_RC_INT_SAME(SIGABRT);
    HHVM_RC_INT_SAME(SIGALRM);
    HHVM_RC_INT_SAME(SIGBUS);
    HHVM_RC_INT_SAME(SIGCHLD);
    HHVM_RC_INT_SAME(SIGCONT);
    HHVM_RC_INT_SAME(SIGFPE);
    HHVM_RC_INT_SAME(SIGHUP);
    HHVM_RC_INT_SAME(SIGILL);
    HHVM_RC_INT_SAME(SIGINT);
    HHVM_RC_INT_SAME(SIGIO);
    HHVM_RC_INT_SAME(SIGIOT);
    HHVM_RC_INT_SAME(SIGKILL);
    HHVM_RC_INT_SAME(SIGPIPE);
    HHVM_RC_INT_SAME(SIGPROF);
    HHVM_RC_INT_SAME(SIGQUIT);
    HHVM_RC_INT_SAME(SIGSEGV);
    HHVM_RC_INT_SAME(SIGSTOP);
    HHVM_RC_INT_SAME(SIGSYS);
    HHVM_RC_INT_SAME(SIGTERM);
    HHVM_RC_INT_SAME(SIGTRAP);
    HHVM_RC_INT_SAME(SIGTSTP);
    HHVM_RC_INT_SAME(SIGTTIN);
    HHVM_RC_INT_SAME(SIGTTOU);
    HHVM_RC_INT_SAME(SIGURG);
    HHVM_RC_INT_SAME(SIGUSR1);
    HHVM_RC_INT_SAME(SIGUSR2);
    HHVM_RC_INT_SAME(SIGVTALRM);
    HHVM_RC_INT_SAME(SIGWINCH);
    HHVM_RC_INT_SAME(SIGXCPU);
    HHVM_RC_INT_SAME(SIGXFSZ);
    HHVM_RC_INT_SAME(SIG_BLOCK);
    HHVM_RC_INT_SAME(SIG_UNBLOCK);
    HHVM_RC_INT_SAME(SIG_SETMASK);

    HHVM_RC_INT(SIG_DFL, (int64_t)SIG_DFL);
    HHVM_RC_INT(SIG_ERR, (int64_t)SIG_ERR);
    HHVM_RC_INT(SIG_IGN, (int64_t)SIG_IGN);

    // http://marc.info/?l=php-cvs&m=100289252314474&w=2
    HHVM_RC_INT(SIGBABY, SIGSYS);
    HHVM_RC_INT(SIGCLD, SIGCHLD);
    HHVM_RC_INT(SIGPOLL, SIGIO);

#ifdef __linux__
    HHVM_RC_INT_SAME(SIGPWR);
    HHVM_RC_INT_SAME(SIGSTKFLT);
#endif

    loadSystemlib("process");
  }