void XDebugProfiler::collectFrameData(FrameData& frameData, const TypedValue* retVal) { VMRegAnchor _; // Ensure consistent state for vmfp and vmpc ActRec* fp = vmfp(); bool is_func_begin = retVal == nullptr; frameData.is_func_begin = is_func_begin; // The function reference and call file/line are stored when tracing/profiling // on function enter if ((m_tracingEnabled || m_profilingEnabled) && is_func_begin) { frameData.func = fp->func(); // Need the previous frame in order to get the call line. If we cannot // get the previous frame, default to 1 Offset offset; const ActRec* prevFp = g_context->getPrevVMState(fp, &offset); if (prevFp != nullptr) { frameData.line = prevFp->unit()->getLineNumber(offset); } else { frameData.line = 1; } } else { frameData.func = nullptr; frameData.line = 1; } // Time is stored if profiling, tracing, or collect_time is enabled, but it // only needs to be collected on function exit if profiling or if computerized // tracing output is enabled if (m_profilingEnabled || (is_func_begin && (m_collectTime || m_tracingEnabled)) || (m_tracingEnabled && (m_tracingOpts & k_XDEBUG_TRACE_COMPUTERIZED))) { frameData.time = Timer::GetCurrentTimeMicros(); } else { frameData.time = 0; } // Memory usage is stored on function begin if tracing, or if collect_memory // is enabled, or on function end if computerized tracing output is enabled if ((is_func_begin && (m_tracingEnabled || m_collectMemory)) || (m_tracingEnabled && (m_tracingOpts & k_XDEBUG_TRACE_COMPUTERIZED))) { frameData.memory_usage = MM().getStats().usage; } else { frameData.memory_usage = 0; } // If tracing is enabled, we may need to collect a serialized version of // the arguments or the return value. if (m_tracingEnabled && is_func_begin && XDEBUG_GLOBAL(CollectParams) > 0) { // TODO(#3704) This relies on xdebug_var_dump throw_not_implemented("Tracing with collect_params enabled"); } else if (m_tracingEnabled && !is_func_begin && XDEBUG_GLOBAL(CollectReturn)) { // TODO(#3704) This relies on xdebug_var_dump throw_not_implemented("Tracing with collect_return enabled"); } else { frameData.context_str = nullptr; } }
bool DateInterval::setInterval(const String& date_interval) { timelib_rel_time *di = nullptr; timelib_error_container *errors = nullptr; #ifdef TIMELIB_HAVE_INTERVAL timelib_time *start = nullptr, *end = nullptr; int r = 0; timelib_strtointerval((char*)date_interval.data(), date_interval.size(), &start, &end, &di, &r, &errors); #else throw_not_implemented("timelib too old"); #endif int error_count = errors->error_count; DateTime::setLastErrors(errors); if (error_count > 0) { timelib_rel_time_dtor(di); return false; } else { #ifdef TIMELIB_HAVE_INTERVAL if (UNLIKELY(!di && start && end)) { timelib_update_ts(start, nullptr); timelib_update_ts(end, nullptr); di = timelib_diff(start, end); } #endif m_di = DateIntervalPtr(di, dateinterval_deleter()); return true; } }
void nativeDataInstanceCopy(ObjectData* dest, ObjectData *src) { auto ndi = dest->getVMClass()->getNativeDataInfo(); if (!ndi) return; assert(ndi == src->getVMClass()->getNativeDataInfo()); if (!ndi->copy) { throw_not_implemented("NativeDataInfoCopy"); } ndi->copy(dest, src); // Already in the sweep list from init call, no need to add again }
Array TimeZone::getLocation() const { Array ret; if (!m_tzi) return ret; #ifdef TIMELIB_HAVE_TZLOCATION ret.set(s_country_code, String(m_tzi->location.country_code, CopyString)); ret.set(s_latitude, m_tzi->location.latitude); ret.set(s_longitude, m_tzi->location.longitude); ret.set(s_comments, String(m_tzi->location.comments, CopyString)); #else throw_not_implemented("timelib version too old"); #endif return ret; }
String StringUtil::HtmlDecode(const String& input, QuoteStyle quoteStyle, const char *charset, bool all) { if (input.empty()) return input; assert(charset); int len = input.size(); char *ret = string_html_decode(input.data(), len, quoteStyle != QuoteStyle::No, quoteStyle == QuoteStyle::Both, charset, all); if (!ret) { // null iff charset was not recognized throw_not_implemented(charset); // (charset is not null, see assertion above) } return String(ret, len, AttachString); }
String StringUtil::HtmlEncode(const String& input, const int64_t qsBitmask, const char *charset, bool dEncode, bool htmlEnt) { if (input.empty()) return input; assert(charset); bool utf8 = true; if (strcasecmp(charset, "ISO-8859-1") == 0) { utf8 = false; } else if (strcasecmp(charset, "UTF-8")) { throw_not_implemented(charset); } int len = input.size(); char *ret = string_html_encode(input.data(), len, qsBitmask, utf8, dEncode, htmlEnt); if (!ret) { return empty_string(); } return String(ret, len, AttachString); }
static void HHVM_FUNCTION(gmp_random, int64_t limiter) { throw_not_implemented(cs_GMP_FUNC_NAME_GMP_RANDOM); }
Variant php_mysql_do_connect_on_link(std::shared_ptr<MySQL> mySQL, String server, String username, String password, String database, int client_flags, bool persistent, bool async, int connect_timeout_ms, int query_timeout_ms) { if (connect_timeout_ms < 0) { connect_timeout_ms = mysqlExtension::ConnectTimeout; } if (query_timeout_ms < 0) { query_timeout_ms = MySQL::GetDefaultReadTimeout(); } if (server.empty()) server = MySQL::GetDefaultServer(); if (username.empty()) username = MySQL::GetDefaultUsername(); if (password.empty()) password = MySQL::GetDefaultPassword(); if (database.empty()) database = MySQL::GetDefaultDatabase(); // server format: hostname[:port][:/path/to/socket] // ipv6 hostname:port is of the form [1:2:3:4:5]:port String host, socket; int port; int savePersistent = false; auto slash_pos = server.find('/'); if (slash_pos != std::string::npos) { socket = server.substr(slash_pos); server = server.substr(0, slash_pos - 1); } HostURL hosturl(std::string(server), MySQL::GetDefaultPort()); if (hosturl.isValid()) { host = hosturl.getHost(); port = hosturl.getPort(); } else { host = server; port = MySQL::GetDefaultPort(); } if (socket.empty()) { socket = MySQL::GetDefaultSocket(); } if (MySQL::IsAllowPersistent() && MySQL::GetCurrentNumPersistent() < MySQL::GetMaxNumPersistent() && persistent) { auto p_mySQL = MySQL::GetPersistent(host, port, socket, username, password, client_flags); if (p_mySQL != nullptr) { mySQL = p_mySQL; } else { savePersistent = true; } } if (mySQL == nullptr) { mySQL = std::make_shared<MySQL>(host.c_str(), port, username.c_str(), password.c_str(), database.c_str()); } if (mySQL->getState() == MySQLState::INITED) { if (async) { #ifdef FACEBOOK if (!mySQL->async_connect(host, port, socket, username, password, database)) { MySQL::SetDefaultConn(mySQL); // so we can report errno by mysql_errno() mySQL->setLastError("mysql_real_connect_nonblocking_init"); return false; } #else throw_not_implemented("mysql_async_connect_start"); #endif } else { if (!mySQL->connect(host, port, socket, username, password, database, client_flags, connect_timeout_ms)) { MySQL::SetDefaultConn(mySQL); // so we can report errno by mysql_errno() mySQL->setLastError("mysql_connect"); return false; } } } else { if (!MySQL::IsAllowReconnect()) { raise_warning("MySQL: Reconnects are not allowed"); return false; } if (!mySQL->reconnect(host, port, socket, username, password, database, client_flags, connect_timeout_ms)) { MySQL::SetDefaultConn(mySQL); // so we can report errno by mysql_errno() mySQL->setLastError("mysql_connect"); return false; } } if (savePersistent) { MySQL::SetPersistent(host, port, socket, username, password, client_flags, mySQL); MySQL::SetCurrentNumPersistent(MySQL::GetCurrentNumPersistent() + 1); } MySQL::SetDefaultConn(mySQL); return Resource(newres<MySQLResource>(mySQL)); }
ArrayData* GlobalsArray::Prepend(ArrayData*, Cell, bool) { throw_not_implemented("prepend on $GLOBALS"); }
ArrayData* GlobalsArray::AppendRef(ArrayData*, Variant&, bool) { throw_not_implemented("appendRef on $GLOBALS"); }
ArrayData* GlobalsArray::Prepend(ArrayData*, const Variant& v, bool copy) { throw_not_implemented("prepend on $GLOBALS"); }
ArrayData* NameValueTableWrapper::AppendWithRef(ArrayData*, const Variant& v, bool copy) { throw_not_implemented("appendWithRef on $GLOBALS"); }
static bool HHVM_METHOD(IntlDateFormatter, setCalendar, const Variant& which) { // TODO: Need IntlCalendar implemented first throw_not_implemented("IntlDateFormatter::setCalendar"); }
static Object HHVM_METHOD(IntlDateFormatter, getCalendarObject) { // TODO: Need IntlCalendar implemented first throw_not_implemented("IntlDateFormatter::getCalendarObject"); }
static String HHVM_STATIC_METHOD(IntlDateFormatter, formatObject, const Object& object, const Variant& format, const Variant& locale) { // TODO: Need IntlCalendar implemented first throw_not_implemented("IntlDateFormatter::formatObject"); }
ArrayData* NameValueTableWrapper::Prepend(ArrayData*, const Variant& v, bool copy) { throw_not_implemented("prepend on $GLOBALS"); }
ArrayData* NameValueTableWrapper::Merge(ArrayData*, const ArrayData* elems) { throw_not_implemented("merge on $GLOBALS"); }
ArrayData* NameValueTableWrapper::PlusEq(ArrayData*, const ArrayData* elems) { throw_not_implemented("plus on $GLOBALS"); }
String StringUtil::HtmlEncodeExtra(const String& input, QuoteStyle quoteStyle, const char *charset, bool nbsp, Array extra) { if (input.empty()) return input; assert(charset); int flags = STRING_HTML_ENCODE_UTF8; if (nbsp) { flags |= STRING_HTML_ENCODE_NBSP; } if (RuntimeOption::Utf8izeReplace) { flags |= STRING_HTML_ENCODE_UTF8IZE_REPLACE; } if (!*charset || strcasecmp(charset, "UTF-8") == 0) { } else if (strcasecmp(charset, "ISO-8859-1") == 0) { flags &= ~STRING_HTML_ENCODE_UTF8; } else { throw_not_implemented(charset); } const AsciiMap *am; AsciiMap tmp; switch (quoteStyle) { case QuoteStyle::FBUtf8Only: am = &mapNothing; flags |= STRING_HTML_ENCODE_HIGH; break; case QuoteStyle::FBUtf8: am = &mapBothQuotes; flags |= STRING_HTML_ENCODE_HIGH; break; case QuoteStyle::Both: am = &mapBothQuotes; break; case QuoteStyle::Double: am = &mapDoubleQuotes; break; case QuoteStyle::No: am = &mapNoQuotes; break; default: am = &mapNothing; raise_error("Unknown quote style: %d", (int)quoteStyle); } if (quoteStyle != QuoteStyle::FBUtf8Only && extra.toBoolean()) { tmp = *am; am = &tmp; for (ArrayIter iter(extra); iter; ++iter) { String item = iter.second().toString(); char c = item.data()[0]; tmp.map[c & 64 ? 1 : 0] |= 1uLL << (c & 63); } } int len = input.size(); char *ret = string_html_encode_extra(input.data(), len, (StringHtmlEncoding)flags, am); if (!ret) { raise_error("HtmlEncode called on too large input (%d)", len); } return String(ret, len, AttachString); }
void CommitEditor::addSymlink(jstring jrelpath, jstring jtarget, jobject jproperties, jlong jreplaces_revision) { throw_not_implemented("addSymlink"); }
ArrayData* GlobalsArray::PlusEq(ArrayData*, const ArrayData* elems) { throw_not_implemented("plus on $GLOBALS"); }
void CommitEditor::alterSymlink(jstring jrelpath, jlong jrevision, jstring jtarget, jobject jproperties) { throw_not_implemented("alterSymlink"); }
ArrayData* GlobalsArray::AppendWithRef(ArrayData*, const Variant& v, bool copy) { throw_not_implemented("appendWithRef on $GLOBALS"); }
ArrayData* GlobalsArray::Append(ArrayData*, Cell /*v*/, bool /*copy*/) { throw_not_implemented("append on $GLOBALS"); }
ArrayData* GlobalsArray::Merge(ArrayData*, const ArrayData* elems) { throw_not_implemented("merge on $GLOBALS"); }
ArrayData* GlobalsArray::AppendRef(ArrayData*, member_lval, bool) { throw_not_implemented("appendRef on $GLOBALS"); }
ArrayData* GlobalsArray::AppendWithRef(ArrayData*, TypedValue, bool) { throw_not_implemented("appendWithRef on $GLOBALS"); }
ArrayData* GlobalsArray::Append(ArrayData*, Cell v, bool copy) { throw_not_implemented("append on $GLOBALS"); }