static inline T xdebug_init_opt(const char* name, T defVal, std::map<std::string, std::string>& envCfg) { // First try to load the ini setting IniSettingMap ini_val; if (IniSetting::Get(XDEBUG_INI(name), ini_val.toVariant())) { T val; ini_on_update(ini_val.toVariant(), val); return val; } // Then try to load from the environment auto const env_iter = envCfg.find(name); if (env_iter != envCfg.end()) { T val; ini_on_update(env_iter->second, val); return val; } // Finally just use the default value return defVal; }
static HackStrictOption GetHackStrictOption(const IniSettingMap& ini, const Hdf& config) { auto val = Config::GetString(ini, config); if (val.empty()) { if (Option::EnableHipHopSyntax || RuntimeOption::EnableHipHopSyntax) { return HackStrictOption::ERROR; } return HackStrictOption::OFF; } if (val == "warn") { return HackStrictOption::WARN; } bool ret; ini_on_update(val, ret); return ret ? HackStrictOption::ERROR : HackStrictOption::OFF; }
static HackStrictOption GetHackStrictOption(const IniSettingMap& ini, const Hdf& config, const std::string& name /* = "" */, HackStrictOption def ) { auto val = Config::GetString(ini, config, name); if (val.empty()) { return def; } if (val == "warn") { return HackStrictOption::WARN; } bool ret; ini_on_update(val, ret); return ret ? HackStrictOption::ON : HackStrictOption::OFF; }
void Config::Bind(std::vector<std::string>& loc, const IniSettingMap& ini, const Hdf& config) { std::vector<std::string> ret; auto ini_name = IniName(config); auto* value = ini.get_ptr(ini_name); if (value && value->isObject()) { ini_on_update(*value, ret); loc = ret; } // If there is an HDF setting for the config, then it still wins for // the RuntimeOption value until we obliterate HDFs ret.clear(); config.configGet(ret); if (ret.size() > 0) { loc = ret; } IniSetting::Bind(IniSetting::CORE, IniSetting::PHP_INI_SYSTEM, ini_name, &loc); }