void raise_strict_warning(const char *fmt, ...) { std::string msg; va_list ap; va_start(ap, fmt); string_vsnprintf(msg, fmt, ap); va_end(ap); raise_strict_warning(msg); }
int f_mysql_next_result(CVarRef link_identifier /* = null */) { MYSQL *conn = MySQL::GetConn(link_identifier); if (conn == nullptr) { return 2006 /* CR_SERVER_GONE_ERROR */; } if (!mysql_more_results(conn)) { raise_strict_warning("There is no next result set. " "Please, call mysql_more_results() to check " "whether to call this function/method"); } return mysql_next_result(conn); }
String TimeZone::CurrentName() { /* Checking configure timezone */ auto& tz = RID().getTimeZone(); if (!tz.empty()) { return String(tz); } /* Check environment variable */ char *env = getenv("TZ"); if (env && *env && IsValid(env)) { return String(env, CopyString); } /* Try to guess timezone from system information */ raise_strict_warning(s_guessed_timezone.m_warning); return String(s_guessed_timezone.m_tzid); }
String TimeZone::CurrentName() { /* Checking configure timezone */ String timezone = g_context->getTimeZone(); if (!timezone.empty()) { return timezone; } /* Check environment variable */ char *env = getenv("TZ"); if (env && *env && IsValid(env)) { return String(env, CopyString); } /* Check config setting for default timezone */ String default_timezone = g_context->getDefaultTimeZone(); if (!default_timezone.empty() && IsValid(default_timezone.data())) { return default_timezone; } /* Try to guess timezone from system information */ raise_strict_warning(s_guessed_timezone.m_warning); return String(s_guessed_timezone.m_tzid); }
Variant HHVM_FUNCTION(mktime, int64_t hour /* = PHP_INT_MAX */, int64_t minute /* = PHP_INT_MAX */, int64_t second /* = PHP_INT_MAX */, int64_t month /* = PHP_INT_MAX */, int64_t day /* = PHP_INT_MAX */, int64_t year /* = PHP_INT_MAX */) { hour = hour < INT_MAX ? hour : INT_MAX; minute = minute < INT_MAX ? minute : INT_MAX; second = second < INT_MAX ? second : INT_MAX; month = month < INT_MAX ? month : INT_MAX; day = day < INT_MAX ? day : INT_MAX; year = year < INT_MAX ? year : INT_MAX; if (hour == INT_MAX && minute == INT_MAX && second == INT_MAX && month == INT_MAX && day == INT_MAX && year == INT_MAX) { raise_strict_warning("mktime(): You should be using " "the time() function instead"); } bool error; int64_t ts = TimeStamp::Get(error, hour, minute, second, month, day, year, false); if (error) return false; return ts; }
bool HHVM_FUNCTION(trigger_error, const String& error_msg, int error_type /* = k_E_USER_NOTICE */) { std::string msg = error_msg.data(); // not toCppString() if (UNLIKELY(g_context->getThrowAllErrors())) { throw Exception(folly::sformat("throwAllErrors: {}", error_type)); } if (error_type == k_E_USER_ERROR) { g_context->handleError(msg, error_type, true, ExecutionContext::ErrorThrowMode::IfUnhandled, "\nFatal error: "); return true; } if (error_type == k_E_USER_WARNING) { g_context->handleError(msg, error_type, true, ExecutionContext::ErrorThrowMode::Never, "\nWarning: "); return true; } if (error_type == k_E_USER_NOTICE) { g_context->handleError(msg, error_type, true, ExecutionContext::ErrorThrowMode::Never, "\nNotice: "); return true; } if (error_type == k_E_USER_DEPRECATED) { g_context->handleError(msg, error_type, true, ExecutionContext::ErrorThrowMode::Never, "\nDeprecated: "); return true; } if (error_type == k_E_STRICT) { // So that we can raise strict warnings for mismatched // params in FCallBuiltin raise_strict_warning(msg); return true; } ActRec* fp = g_context->getStackFrame(); if (fp->m_func->isNative() && fp->m_func->nativeFuncPtr() == (BuiltinFunction)HHVM_FN(trigger_error)) { fp = g_context->getOuterVMFrame(fp); } if (fp && fp->m_func->isBuiltin()) { if (error_type == k_E_ERROR) { raise_error_without_first_frame(msg); return true; } if (error_type == k_E_WARNING) { raise_warning_without_first_frame(msg); return true; } if (error_type == k_E_NOTICE) { raise_notice_without_first_frame(msg); return true; } if (error_type == k_E_DEPRECATED) { raise_deprecated_without_first_frame(msg); return true; } if (error_type == k_E_RECOVERABLE_ERROR) { raise_recoverable_error_without_first_frame(msg); return true; } } raise_warning("Invalid error type specified"); return false; }