Variant f_http_build_query(CVarRef formdata, CStrRef numeric_prefix /* = null_string */, CStrRef arg_separator /* = null_string */) { if (!formdata.is(KindOfArray) && !formdata.is(KindOfObject)) { throw_invalid_argument("formdata: (need Array or Object)"); return false; } String arg_sep; if (arg_separator.isNull()) { arg_sep = f_ini_get("arg_separator.output"); } else { arg_sep = arg_separator; } StringBuffer ret(1024); std::set<void*> seen_arrs; url_encode_array(ret, formdata, seen_arrs, numeric_prefix, String(), String(), arg_sep); return ret.detach(); }
void f_spl_autoload(CStrRef class_name, CStrRef file_extensions /* = null_string */) { Array ext = file_extensions.isNull() ? s_extension_list->extensions : StringUtil::Explode(file_extensions, ",").toArray(); String lClass = StringUtil::ToLower(class_name); Globals *variables = hhvm ? nullptr : get_globals(); bool found = false; for (ArrayIter iter(ext); iter; ++iter) { String fileName = lClass + iter.second(); include(fileName, true, variables, "", false); if (f_class_exists(class_name, false)) { found = true; break; } } if (!found && !AutoloadHandler::s_instance->isRunning()) { throw_spl_exception("Class %s could not be loaded", class_name.c_str()); } }
bool c_XMLWriter::t_writeelement(CStrRef name, CStrRef content /* = null_string */) { INSTANCE_METHOD_INJECTION_BUILTIN(XMLWriter, XMLWriter::writeelement); if (xmlValidateName((xmlChar*)name.data(), 0)) { raise_warning("invalid element name: %s", name.data()); return false; } int ret = -1; if (m_ptr) { if (content.isNull()) { ret = xmlTextWriterStartElement(m_ptr, (xmlChar*)name.data()); if (ret == -1) return false; ret = xmlTextWriterEndElement(m_ptr); if (ret == -1) return false; } else { ret = xmlTextWriterWriteElement(m_ptr, (xmlChar*)name.data(), (xmlChar*)content.data()); } } return ret != -1; }
p_Continuation f_hphp_create_continuation(CStrRef clsname, CStrRef funcname, CStrRef origFuncName, CArrRef args /* = null_array */) { if (hhvm) { throw_fatal("hphp_create_continuation is not supported under hhvm"); } Array definedVariables; Object obj; Eval::VariableEnvironment *env = FrameInjection::GetVariableEnvironment(true); if (UNLIKELY(!env)) { throw_fatal("Invalid call hphp_create_continuation"); } definedVariables = env->getDefinedVariables(); obj = FrameInjection::GetThis(true); bool isMethod = !clsname.isNull() && !clsname.empty(); int64 callInfo = f_hphp_get_call_info(clsname, funcname); int64 extra = f_hphp_get_call_info_extra(clsname, funcname); if (has_eval_support && isMethod && Eval::MethodStatementWrapper::isTraitMethod( (const Eval::MethodStatementWrapper *)extra)) { extra = f_hphp_get_call_info_extra(FrameInjection::GetClassName(false), funcname); } p_GenericContinuation cont( ((c_GenericContinuation*)coo_GenericContinuation())-> create(callInfo, extra, isMethod, origFuncName, definedVariables, obj, args)); if (isMethod) { CStrRef cls = f_get_called_class(); cont->setCalledClass(cls); } return cont; }
bool c_xmlwriter::t_writeelementns(CStrRef prefix, CStrRef name, CStrRef uri, CStrRef content /* = null_string */) { if (xmlValidateName((xmlChar*)name.data(), 0)) { raise_warning("invalid element name: %s", name.data()); return false; } int ret = -1; if (m_ptr) { if (content.isNull()) { ret = xmlTextWriterStartElementNS(m_ptr, (xmlChar*)prefix.data(), (xmlChar*)name.data(), (xmlChar*)uri.data()); if (ret == -1) return false; ret = xmlTextWriterEndElement(m_ptr); if (ret == -1) return false; } else { ret = xmlTextWriterWriteElementNS(m_ptr, (xmlChar*)prefix.data(), (xmlChar*)name.data(), (xmlChar*)uri.data(), (xmlChar*)content.data()); } } return ret != -1; }