bool c_Memcache::t_set(CStrRef key, CVarRef var, int flag /*= 0*/, int expire /*= 0*/) { INSTANCE_METHOD_INJECTION_BUILTIN(Memcache, Memcache::set); if (key.empty()) { raise_warning("Key cannot be empty"); return false; } String serialized = memcache_prepare_for_storage(var, flag); memcached_return_t ret = memcached_set(&m_memcache, key.c_str(), key.length(), serialized.c_str(), serialized.length(), expire, flag); if (ret == MEMCACHED_SUCCESS) { return true; } return false; }
void c_MutableArrayIterator::t___construct(VRefParam array) { INSTANCE_METHOD_INJECTION_BUILTIN(MutableArrayIterator, MutableArrayIterator::__construct); if (m_valid) { MIterCtx& mi = marr(); mi.~MIterCtx(); m_valid = false; } Variant var(strongBind(array)); TypedValue* tv = (TypedValue*)(&var); ASSERT(tv->m_type == KindOfRef); TypedValue* rtv = tv->m_data.pref->tv(); if (rtv->m_type == KindOfArray) { MIterCtx& mi = marr(); (void) new (&mi) MIterCtx(tv->m_data.pref); m_valid = mi.mArray().advance(); if (!m_valid) mi.~MIterCtx(); } else if (rtv->m_type == KindOfObject) { CStrRef ctxStr = hhvm ? g_vmContext->getContextClassName() : FrameInjection::GetClassName(true); if (rtv->m_data.pobj->isCollection()) { raise_error("Collection elements cannot be taken by reference"); } bool isIterator; Object obj = rtv->m_data.pobj->iterableObject(isIterator); if (isIterator) { raise_error("An iterator cannot be used with foreach by reference"); } Array iterArray = obj->o_toIterArray(ctxStr, true); ArrayData* ad = iterArray.detach(); MIterCtx& mi = marr(); (void) new (&mi) MIterCtx(ad); m_valid = mi.mArray().advance(); if (!m_valid) mi.~MIterCtx(); } else { raise_warning("Invalid argument supplied for foreach()"); } }
/* SRC: classes/splobjectstorage.php line 102 */ bool c_SplObjectStorage::t_contains(CVarRef v_obj) { INSTANCE_METHOD_INJECTION_BUILTIN(SplObjectStorage, SplObjectStorage::contains); Variant v_object; ObjectData *obj_tmp UNUSED; if (x_is_object(v_obj)) { { { LOOP_COUNTER(1); ArrayIter iter3; { Variant map2 = m_storage; iter3.begin(map2, s_class_name); try { if (iter3.end()) goto break1; } catch (...) { iter3.reset(); throw; } } do { LOOP_COUNTER_CHECK(1); iter3.second(v_object); { if (same(v_object, v_obj)) { { return true; } } } } while(iter3.next(), !iter3.end()); break1:; } } } return false; }
c_Continuation::c_Continuation(const ObjectStaticCallbacks *cb) : ExtObjectData(cb), #ifndef HHVM LABEL_INIT, #endif m_index(-1LL), m_value(Variant::nullInit), m_received(Variant::nullInit), m_done(false), m_running(false), m_should_throw(false), m_isMethod(false), m_callInfo(NULL), m_extra(NULL) #ifdef HHVM ,LABEL_INIT #endif { CPP_BUILTIN_CLASS_INIT(Continuation); } #undef LABEL_INIT c_Continuation::~c_Continuation() {} void c_Continuation::t___construct( int64 func, int64 extra, bool isMethod, CStrRef origFuncName, CVarRef obj, CArrRef args) { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::__construct); m_callInfo = (const CallInfo*) func; m_extra = (void*) extra; m_isMethod = isMethod; m_origFuncName = origFuncName; if (!obj.isNull()) { m_obj = obj.toObject(); ASSERT(!m_obj.isNull()); } else { ASSERT(m_obj.isNull()); } m_args = args; ASSERT(m_callInfo); }
bool c_SQLite3::t_createfunction(CStrRef name, CVarRef callback, int64 argcount /* = -1 */) { INSTANCE_METHOD_INJECTION_BUILTIN(SQLite3, SQLite3::createfunction); validate(); if (name.empty()) { return false; } if (!f_is_callable(callback)) { raise_warning("Not a valid callback function %s", callback.toString().data()); return false; } UserDefinedFuncPtr udf(new UserDefinedFunc()); if (sqlite3_create_function(m_raw_db, name.data(), argcount, SQLITE_UTF8, udf.get(), php_sqlite3_callback_func, NULL, NULL) == SQLITE_OK) { udf->func = callback; udf->argc = argcount; m_udfs.push_back(udf); return true; } return false; }
String c_Continuation::t_getorigfuncname() { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::getorigfuncname); if (hhvm) { c_GenericContinuation* self = static_cast<c_GenericContinuation*>(this); VM::Class* vmClass = self->getVMCalledClass(); if (vmClass != NULL && m_called_class.size() == 0) { m_called_class = vmClass->name()->data(); } } if (m_called_class.size() == 0) { return m_origFuncName; } /* Replace the class name in m_origFuncName with the LSB class. This produces more useful traces. */ size_t method_pos = m_origFuncName.find("::"); if (method_pos != std::string::npos) { return concat3(m_called_class, "::", m_origFuncName.substr(method_pos+2)); } else { return m_origFuncName; } }
void c_Continuation::t_update(int64 label, CVarRef value) { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::update); m_label = label; m_value.assignVal(value); }
void c_Continuation::t_rewind() { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::rewind); throw_exception(Object(SystemLib::AllocExceptionObject( "Cannot rewind on a Continuation object"))); }
bool c_Continuation::t_valid() { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::valid); const_assert(!hhvm); return !m_done; }
Variant c_Continuation::t_current() { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::current); const_assert(!hhvm); nextCheck(); return m_value; }
void c_Continuation::t_next() { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::next); const_assert(!hhvm); m_received.setNull(); nextImpl(fi); }
Variant c_Normalizer::t___destruct() { INSTANCE_METHOD_INJECTION_BUILTIN(Normalizer, Normalizer::__destruct); return null; }
Variant c_Continuation::t_get_arg(int64 id) { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::get_arg); if (id < 0LL || id >= m_args.size()) return false; return m_args.rvalAt(id, AccessFlags::Error); }
int64 c_DummyContinuation::t_key() { INSTANCE_METHOD_INJECTION_BUILTIN(DummyContinuation, DummyContinuation::key); throw_fatal("Tring to use a DummyContinuation"); return 0; }
bool c_DummyContinuation::t_valid() { INSTANCE_METHOD_INJECTION_BUILTIN(DummyContinuation, DummyContinuation::valid); throw_fatal("Tring to use a DummyContinuation"); return false; }
Variant c_Continuation::t___clone() { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::__clone); throw_fatal( "Trying to clone an uncloneable object of class Continuation"); return null; }
Variant c_GenericContinuation::t___destruct() { INSTANCE_METHOD_INJECTION_BUILTIN(GenericContinuation, GenericContinuation::__destruct); return null; }
bool c_Memcache::t_pconnect(CStrRef host, int port /*= 0*/, int timeout /*= 0*/, int timeoutms /*= 0*/) { INSTANCE_METHOD_INJECTION_BUILTIN(Memcache, Memcache::pconnect); return t_connect(host, port, timeout, timeoutms); }
/* SRC: classes/directory.php line 20 */ void c_Directory::t_close() { INSTANCE_METHOD_INJECTION_BUILTIN(Directory, Directory::close); x_closedir(toObject(m_handle)); }
/* SRC: classes/directory.php line 16 */ void c_Directory::t_rewind() { INSTANCE_METHOD_INJECTION_BUILTIN(Directory, Directory::rewind); x_rewinddir(toObject(m_handle)); }
/* SRC: classes/directory.php line 12 */ Variant c_Directory::t_read() { INSTANCE_METHOD_INJECTION_BUILTIN(Directory, Directory::read); return x_readdir(toObject(m_handle)); }
Variant c_Memcache::t_get(CVarRef key, Variant flags /*= null*/) { INSTANCE_METHOD_INJECTION_BUILTIN(Memcache, Memcache::get); if (key.is(KindOfArray)) { std::vector<const char *> real_keys; std::vector<size_t> key_len; Array keyArr = key.toArray(); real_keys.reserve(keyArr.size()); key_len.reserve(keyArr.size()); for (ArrayIter iter(keyArr); iter; ++iter) { real_keys.push_back(const_cast<char *>(iter.second().toString().c_str())); key_len.push_back(iter.second().toString().length()); } if (!real_keys.empty()) { const char *payload = NULL; size_t payload_len = 0; uint32_t flags = 0; const char *res_key = NULL; size_t res_key_len = 0; memcached_result_st result; memcached_return_t ret = memcached_mget(&m_memcache, &real_keys[0], &key_len[0], real_keys.size()); memcached_result_create(&m_memcache, &result); Array return_val; while ((memcached_fetch_result(&m_memcache, &result, &ret)) != NULL) { if (ret != MEMCACHED_SUCCESS) { // should probably notify about errors continue; } payload = memcached_result_value(&result); payload_len = memcached_result_length(&result); flags = memcached_result_flags(&result); res_key = memcached_result_key_value(&result); res_key_len = memcached_result_key_length(&result); return_val.set(String(res_key, res_key_len, CopyString), memcache_fetch_from_storage(payload, payload_len, flags)); } memcached_result_free(&result); return return_val; } } else if (key.isString()) { char *payload = NULL; size_t payload_len = 0; uint32_t flags = 0; memcached_return_t ret; String skey = key.toString(); payload = memcached_get(&m_memcache, skey.c_str(), skey.length(), &payload_len, &flags, &ret); /* This is for historical reasons from libmemcached*/ if (ret == MEMCACHED_END) { ret = MEMCACHED_NOTFOUND; } if (ret == MEMCACHED_NOTFOUND) { return false; } Variant retval = memcache_fetch_from_storage(payload, payload_len, flags); free(payload); return retval; } return false; }
Array c_GenericContinuation::t_getvars() { INSTANCE_METHOD_INJECTION_BUILTIN(GenericContinuation, GenericContinuation::getvars); return m_vars; }
void c_Continuation::t_done() { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::done); m_done = true; }
Variant c_DummyContinuation::t_current() { INSTANCE_METHOD_INJECTION_BUILTIN(DummyContinuation, DummyContinuation::current); throw_fatal("Tring to use a DummyContinuation"); return null; }
int64 c_Continuation::t_getlabel() { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::getlabel); return m_label; }
void c_DummyContinuation::t_rewind() { INSTANCE_METHOD_INJECTION_BUILTIN(DummyContinuation, DummyContinuation::rewind); throw_fatal("Tring to use a DummyContinuation"); }
int64 c_Continuation::t_num_args() { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::num_args); return m_args.size(); }
Variant c_DummyContinuation::t___destruct() { INSTANCE_METHOD_INJECTION_BUILTIN(DummyContinuation, DummyContinuation::__destruct); return null; }
Array c_Continuation::t_get_args() { INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::get_args); return m_args; }