void Injection::execute() const { if (m_builtin) { ASSERT(m_callback); // Execute function in runtime m_callback(m_arg); return; } // Execute php code piece TypedValue retval; VarEnv *varEnv = NULL; ActRec *cfpSave = NULL; ObjectData *this_ = NULL; Class *cls = NULL; ActRec *fp = g_vmContext->getFP(); if (fp) { if (!fp->hasVarEnv()) { fp->m_varEnv = VarEnv::createLazyAttach(fp); } varEnv = fp->m_varEnv; cfpSave = varEnv->getCfp(); if (fp->hasThis()) { this_ = fp->getThis(); } else if (fp->hasClass()) { cls = fp->getClass(); } } // Note: For now we don't merge analysis code's class and function. // Later we might decide to do so g_vmContext->invokeFunc(&retval, m_unit->getMain(), Array::Create(), this_, cls, varEnv, NULL, NULL); if (varEnv) { varEnv->setCfp(cfpSave); } }
Variant f_get_called_class() { EagerCallerFrame cf; ActRec* ar = cf(); if (ar) { if (ar->hasThis()) return Variant(ar->getThis()->o_getClassName()); if (ar->hasClass()) return Variant(ar->getClass()->preClass()->name()); } return Variant(false); }
Variant f_get_called_class() { CallerFrame cf; ActRec* ar = cf(); if (ar == NULL) { return Variant(false); } if (ar->hasThis()) { ObjectData* obj = ar->getThis(); return obj->o_getClassName(); } else if (ar->hasClass()) { return ar->getClass()->preClass()->name()->data(); } else { return Variant(false); } }
Variant HHVM_FUNCTION(get_called_class) { EagerCallerFrame cf; ActRec* ar = cf(); if (ar) { if (ar->hasThis()) { return Variant(ar->getThis()->getClassName()); } if (ar->hasClass()) { return Variant(ar->getClass()->preClass()->name(), Variant::StaticStrInit{}); } } raise_warning("get_called_class() called from outside a class"); return Variant(false); }
Variant f_get_called_class() { if (hhvm) { CallerFrame cf; ActRec* ar = cf(); if (ar == NULL) { return Variant(false); } if (ar->hasThis()) { ObjectData* obj = ar->getThis(); return obj->o_getClassName(); } else if (ar->hasClass()) { return ar->getClass()->preClass()->name()->data(); } else { return Variant(false); } } else { CStrRef cls = FrameInjection::GetStaticClassName( ThreadInfo::s_threadInfo.getNoCheck()); return cls.size() ? Variant(cls.get()) : Variant(false); } }