From 327ee72dc5e3dd2b7d097dd5ab685ca323b752d3 Mon Sep 17 00:00:00 2001 From: Max Wang Date: Wed, 3 Apr 2019 19:37:11 -0700 Subject: [PATCH] Rename IntishCast enum values Summary: s/CastSilently/Cast/, s/AllowCastAndWarn/None/ Reviewed By: ricklavoie Differential Revision: D14692180 fbshipit-source-id: 89c7ed2b9938acd96e3a13e540d2c885aaa220f0 --- hphp/runtime/base/array-data-defs.h | 4 +- hphp/runtime/base/array-data.h | 21 ++--------- hphp/runtime/base/array-init.h | 4 +- hphp/runtime/base/array-util.cpp | 6 +-- hphp/runtime/base/autoload-handler.cpp | 2 +- hphp/runtime/base/collections.cpp | 4 +- hphp/runtime/base/collections.h | 2 +- hphp/runtime/base/execution-context.cpp | 2 +- hphp/runtime/base/ini-setting.cpp | 4 +- hphp/runtime/base/mixed-array.cpp | 10 ++--- hphp/runtime/base/object-data.cpp | 6 +-- hphp/runtime/base/object-data.h | 2 +- hphp/runtime/base/program-functions.cpp | 6 +-- hphp/runtime/base/set-array.cpp | 6 +-- hphp/runtime/base/tv-conversions.cpp | 42 ++++++++++----------- hphp/runtime/base/tv-conversions.h | 12 +++--- hphp/runtime/base/type-array.cpp | 2 +- hphp/runtime/base/type-array.h | 8 ++-- hphp/runtime/base/type-variant.h | 4 +- hphp/runtime/ext/array/ext_array.cpp | 44 +++++++++++----------- hphp/runtime/ext/array/ext_array.h | 4 +- .../ext/collections/ext_collections-map.cpp | 2 +- hphp/runtime/ext/collections/ext_collections-map.h | 2 +- .../runtime/ext/collections/ext_collections-pair.h | 2 +- .../ext/collections/ext_collections-set.cpp | 2 +- hphp/runtime/ext/collections/ext_collections-set.h | 2 +- .../ext/collections/ext_collections-vector.h | 2 +- hphp/runtime/ext/collections/hash-collection.h | 6 +-- hphp/runtime/ext/fb/VariantController.h | 4 +- hphp/runtime/ext/fb/ext_fb.cpp | 2 +- hphp/runtime/ext/mailparse/mime.cpp | 16 ++++---- hphp/runtime/ext/mysql/mysql_common.cpp | 4 +- hphp/runtime/ext/pdo/ext_pdo.cpp | 18 ++++----- hphp/runtime/ext/reflection/ext_reflection.cpp | 2 +- hphp/runtime/ext/string/ext_string.cpp | 2 +- hphp/runtime/ext/thrift/binary.cpp | 6 +-- hphp/runtime/server/http-protocol.cpp | 8 ++-- hphp/runtime/server/source-root-info.cpp | 2 +- 38 files changed, 132 insertions(+), 145 deletions(-) diff --git a/hphp/runtime/base/array-data-defs.h b/hphp/runtime/base/array-data-defs.h index 503475100cd..415574a8a52 100644 --- a/hphp/runtime/base/array-data-defs.h +++ b/hphp/runtime/base/array-data-defs.h @@ -646,7 +646,7 @@ inline Variant ArrayData::getKey(ssize_t pos) const { template ALWAYS_INLINE bool ArrayData::convertKey(const StringData* key, int64_t& i) const { - return IC == IntishCast::CastSilently && + return IC == IntishCast::Cast && key->isStrictlyInteger(i) && useWeakKeys(); } @@ -655,7 +655,7 @@ template ALWAYS_INLINE folly::Optional tryIntishCast(const StringData* key) { int64_t i; - if (UNLIKELY(IC == IntishCast::CastSilently && + if (UNLIKELY(IC == IntishCast::Cast && key->isStrictlyInteger(i))) { return i; } diff --git a/hphp/runtime/base/array-data.h b/hphp/runtime/base/array-data.h index 87016f63716..c4dc6aa47eb 100644 --- a/hphp/runtime/base/array-data.h +++ b/hphp/runtime/base/array-data.h @@ -63,22 +63,9 @@ struct arr_lval : tv_lval { /* * We use this enum as a template parameter in a few key places to determine - * whether or not a check for intish cast should occur and if a warning should - * be logged. - * - * Currently, there a few spots in extensions where we cast explicitly and do - * not log (CastSilently) In the JIT and the rest of the runtime, whether we - * [cast and possibly warn] or [don't cast at all] is controlled by a runtime - * flag. Whether the warning is emitted or not is controlled by another flag. - - * Eventually, the flag will go away and we will default to not checking/casting - * at all, except where the cast was made explicit (CastSilently) + * whether we should explicitly perform legacy PHP intish key cast. */ -enum class IntishCast : int8_t { - AllowCastAndWarn, /* Cast if EnableIntishCast allows it, - Log if CheckIntishCast is on and we casted */ - CastSilently, /* Unconditionally do cast, never log */ -}; +enum class IntishCast : int8_t { None, Cast }; struct ArrayData : MaybeCountable { /* @@ -766,7 +753,7 @@ public: * (which may depend on the array kind, e.g.). If true, `i' is set to the * intish value of `key'. */ - template + template bool convertKey(const StringData* key, int64_t& i) const; /* @@ -1064,7 +1051,7 @@ bool checkHACArrayKeyCast(); /* * Like isStrictlyInteger() but changes behavior with the value of `ic'. */ -template +template folly::Optional tryIntishCast(const StringData* key); /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/base/array-init.h b/hphp/runtime/base/array-init.h index da3db7bfa28..1cf2b79f496 100644 --- a/hphp/runtime/base/array-init.h +++ b/hphp/runtime/base/array-init.h @@ -297,7 +297,7 @@ struct MixedPHPArrayInitBase : ArrayInitBase { * (not-integer-like) or not when using MixedPHPArrayInitBase, and if not you * should probably use toKey yourself. */ - template + template MixedPHPArrayInitBase& setUnknownKey(const Variant& name, const Variant& v) { auto const k = name.toKey(this->m_arr).tv(); if (LIKELY(!isNullType(k.m_type))) { @@ -897,7 +897,7 @@ struct DArrayInit { return setValidKey(*name.asTypedValue(), *v.asTypedValue()); } - template + template DArrayInit& setUnknownKey(const Variant& name, const Variant& v) { auto const k = name.toKey(m_arr).tv(); if (LIKELY(!isNullType(k.m_type))) { diff --git a/hphp/runtime/base/array-util.cpp b/hphp/runtime/base/array-util.cpp index 3eb70a92559..f23389e29c5 100644 --- a/hphp/runtime/base/array-util.cpp +++ b/hphp/runtime/base/array-util.cpp @@ -253,7 +253,7 @@ Variant ArrayUtil::CountValues(const Array& input) { if (isIntType(inner.type()) || isStringType(inner.type()) || isFuncType(inner.type()) || isClassType(inner.type())) { auto const inner_key = - ret.convertKey(inner.tv()); + ret.convertKey(inner.tv()); if (!ret.exists(inner_key)) { ret.set(inner_key, make_tv(1)); } else { @@ -413,7 +413,7 @@ Variant ArrayUtil::StringUnique(const Array& input) { auto const str = tvCastToString(iter.secondVal()); if (!seenValues.exists(str)) { seenValues.append(str); - ret.set(ret.convertKey(iter.first()), + ret.set(ret.convertKey(iter.first()), iter.secondVal()); } } @@ -428,7 +428,7 @@ Variant ArrayUtil::NumericUnique(const Array& input) { std::pair::iterator, bool> res = seenValues.insert(value); if (res.second) { // it was inserted - ret.set(ret.convertKey(iter.first()), + ret.set(ret.convertKey(iter.first()), iter.secondVal()); } } diff --git a/hphp/runtime/base/autoload-handler.cpp b/hphp/runtime/base/autoload-handler.cpp index c0ae6e8b835..e6892b99e27 100644 --- a/hphp/runtime/base/autoload-handler.cpp +++ b/hphp/runtime/base/autoload-handler.cpp @@ -363,7 +363,7 @@ bool AutoloadHandler::autoloadClassPHP5Impl(const String& className, // in which case autoload is allowed to be reentrant. if (!forceSplStack) { const auto arrkey = - m_loading.convertKey(className); + m_loading.convertKey(className); if (m_loading.exists(arrkey)) { return false; } m_loading.set(arrkey, make_tv(className.get())); } else { diff --git a/hphp/runtime/base/collections.cpp b/hphp/runtime/base/collections.cpp index 485277a233e..b79735d57c1 100644 --- a/hphp/runtime/base/collections.cpp +++ b/hphp/runtime/base/collections.cpp @@ -94,9 +94,9 @@ COLLECTIONS_ALL_TYPES(X) } template -Array toArray(const ObjectData*); +Array toArray(const ObjectData*); template -Array toArray(const ObjectData*); +Array toArray(const ObjectData*); bool toBool(const ObjectData* obj) { assertx(obj->isCollection()); diff --git a/hphp/runtime/base/collections.h b/hphp/runtime/base/collections.h index a7cbd08f546..0431b02cf9a 100644 --- a/hphp/runtime/base/collections.h +++ b/hphp/runtime/base/collections.h @@ -93,7 +93,7 @@ bool isType(const Class* cls, CollectionType type, Args... args) { return isType(cls, type) || isType(cls, args...); } -template +template Array toArray(const ObjectData* obj); bool toBool(const ObjectData* obj); diff --git a/hphp/runtime/base/execution-context.cpp b/hphp/runtime/base/execution-context.cpp index ab0b4653724..885e2a884b0 100644 --- a/hphp/runtime/base/execution-context.cpp +++ b/hphp/runtime/base/execution-context.cpp @@ -1045,7 +1045,7 @@ void ExecutionContext::debuggerInfo( } void ExecutionContext::setenv(const String& name, const String& value) { - m_envs.set(m_envs.convertKey(name), + m_envs.set(m_envs.convertKey(name), make_tv(value.get())); } diff --git a/hphp/runtime/base/ini-setting.cpp b/hphp/runtime/base/ini-setting.cpp index 52b5ca0f96e..1a1318a2e33 100644 --- a/hphp/runtime/base/ini-setting.cpp +++ b/hphp/runtime/base/ini-setting.cpp @@ -526,7 +526,7 @@ IniSettingMap::IniSettingMap(IniSettingMap&& i) noexcept { const IniSettingMap IniSettingMap::operator[](const String& key) const { assertx(this->isArray()); - if (auto const intish = tryIntishCast(key.get())) { + if (auto const intish = tryIntishCast(key.get())) { return IniSettingMap(m_map.toCArrRef()[*intish]); } return IniSettingMap(m_map.toCArrRef()[key]); @@ -628,7 +628,7 @@ void IniSetting::ParserCallback::makeArray(tv_lval val, // b will be hash and an array already, but c and d might // not exist and will need to be made an array auto& arr = forceToArray(val); - const auto key = arr.convertKey(index); + const auto key = arr.convertKey(index); if (last) { String s{value}; arr.set(key, make_tv(s.get())); diff --git a/hphp/runtime/base/mixed-array.cpp b/hphp/runtime/base/mixed-array.cpp index f7e0f3414c0..75a6bc03154 100644 --- a/hphp/runtime/base/mixed-array.cpp +++ b/hphp/runtime/base/mixed-array.cpp @@ -1729,7 +1729,7 @@ ArrayData* MixedArray::ToPHPArrayIntishCast(ArrayData* in, bool copy) { if (adIn->size() == 0) return staticEmptyArray(); if (copy || adIn->hasIntishKeys()) { - return copyWithIntishCast(adIn); + return copyWithIntishCast(adIn); } else { // we don't need to CoW and there were no intish keys, so we can just update // dv-arrayness in place and get on with our day @@ -1769,14 +1769,14 @@ ArrayData* MixedArray::FromDictImpl(ArrayData* adIn, } ArrayData* MixedArray::ToPHPArrayDict(ArrayData* adIn, bool copy) { - auto out = FromDictImpl(adIn, copy, false); + auto out = FromDictImpl(adIn, copy, false); assertx(out->isNotDVArray()); assertx(!out->isLegacyArray()); return out; } ArrayData* MixedArray::ToPHPArrayIntishCastDict(ArrayData* adIn, bool copy) { - auto out = FromDictImpl(adIn, copy, false); + auto out = FromDictImpl(adIn, copy, false); assertx(out->isNotDVArray()); assertx(!out->isLegacyArray()); return out; @@ -1808,7 +1808,7 @@ ArrayData* MixedArray::ToDArray(ArrayData* in, bool copy) { ArrayData* MixedArray::ToDArrayDict(ArrayData* in, bool copy) { if (RuntimeOption::EvalHackArrDVArrs) return in; - auto out = FromDictImpl(in, copy, true); + auto out = FromDictImpl(in, copy, true); assertx(out->isDArray()); assertx(!out->isLegacyArray()); return out; @@ -1817,7 +1817,7 @@ ArrayData* MixedArray::ToDArrayDict(ArrayData* in, bool copy) { ArrayData* MixedArray::ToDArrayShape(ArrayData* in, bool copy) { assertx(in->isShape()); if (RuntimeOption::EvalHackArrDVArrs) { - auto out = FromDictImpl(in, copy, true); + auto out = FromDictImpl(in, copy, true); assertx(out->isDArray()); assertx(!out->isLegacyArray()); return out; diff --git a/hphp/runtime/base/object-data.cpp b/hphp/runtime/base/object-data.cpp index 2b8b44008f2..d829a0958e1 100644 --- a/hphp/runtime/base/object-data.cpp +++ b/hphp/runtime/base/object-data.cpp @@ -582,7 +582,7 @@ const int64_t ARRAY_OBJ_ITERATOR_STD_PROP_LIST = 1; const StaticString s_flags("flags"); -template +template Array ObjectData::toArray(bool pubOnly /* = false */, bool ignoreLateInit /* = false */) const { assertx(kindIsValid()); @@ -635,9 +635,9 @@ Array ObjectData::toArray(bool pubOnly /* = false */, } template -Array ObjectData::toArray(bool, bool) const; +Array ObjectData::toArray(bool, bool) const; template -Array ObjectData::toArray(bool, bool) const; +Array ObjectData::toArray(bool, bool) const; namespace { diff --git a/hphp/runtime/base/object-data.h b/hphp/runtime/base/object-data.h index 710b7a5cfc0..6913b86ef58 100644 --- a/hphp/runtime/base/object-data.h +++ b/hphp/runtime/base/object-data.h @@ -303,7 +303,7 @@ struct ObjectData : Countable, type_scan::MarkCollectable { int64_t toInt64() const; double toDouble() const; - template + template Array toArray(bool pubOnly = false, bool ignoreLateInit = false) const; /* diff --git a/hphp/runtime/base/program-functions.cpp b/hphp/runtime/base/program-functions.cpp index aa16d2caa36..428086b8943 100644 --- a/hphp/runtime/base/program-functions.cpp +++ b/hphp/runtime/base/program-functions.cpp @@ -261,7 +261,7 @@ static void process_env_variables(Array& variables, char** envp, std::map& envVariables) { for (auto& kv : envVariables) { String idx(kv.first); - auto const arrkey = variables.convertKey(idx); + auto const arrkey = variables.convertKey(idx); String str(kv.second); variables.set(arrkey, make_tv(str.get())); } @@ -367,7 +367,7 @@ void register_variable(Array& variables, char *name, const Variant& value, } else { String key_str(index, index_len, CopyString); auto const key = - symtable->convertKey(key_str.toCell()); + symtable->convertKey(key_str.toCell()); auto const v = symtable->rvalAt(key).unboxed(); if (isNullType(v.type()) || !isArrayLikeType(v.type())) { symtable->set(key, make_tv(staticEmptyArray())); @@ -395,7 +395,7 @@ void register_variable(Array& variables, char *name, const Variant& value, } else { String key_str(index, index_len, CopyString); auto key = - symtable->convertKey(key_str.toCell()); + symtable->convertKey(key_str.toCell()); if (overwrite || !symtable->exists(key)) { symtable->set(key, *value.toCell(), true); } diff --git a/hphp/runtime/base/set-array.cpp b/hphp/runtime/base/set-array.cpp index 7c6f067e66f..979dc287cb4 100644 --- a/hphp/runtime/base/set-array.cpp +++ b/hphp/runtime/base/set-array.cpp @@ -926,20 +926,20 @@ ArrayData* SetArray::ToArrayImpl(ArrayData* ad, bool toDArray) { ArrayData* SetArray::ToPHPArray(ArrayData* ad, bool) { auto out = - ToArrayImpl(ad, false); + ToArrayImpl(ad, false); assertx(out->isNotDVArray()); return out; } ArrayData* SetArray::ToPHPArrayIntishCast(ArrayData* ad, bool) { - auto out = ToArrayImpl(ad, false); + auto out = ToArrayImpl(ad, false); assertx(out->isNotDVArray()); return out; } ArrayData* SetArray::ToDArray(ArrayData* ad, bool copy) { if (RuntimeOption::EvalHackArrDVArrs) return ToDict(ad, copy); - auto out = ToArrayImpl(ad, true); + auto out = ToArrayImpl(ad, true); assertx(out->isDArray()); return out; } diff --git a/hphp/runtime/base/tv-conversions.cpp b/hphp/runtime/base/tv-conversions.cpp index ad0f439a42f..35209ad8a83 100644 --- a/hphp/runtime/base/tv-conversions.cpp +++ b/hphp/runtime/base/tv-conversions.cpp @@ -640,17 +640,17 @@ ArrayData* tvCastToArrayLikeData(TypedValue tv) { } template -ArrayData* tvCastToArrayLikeData(TypedValue); +ArrayData* tvCastToArrayLikeData(TypedValue); template -ArrayData* tvCastToArrayLikeData(TypedValue); +ArrayData* tvCastToArrayLikeData(TypedValue); -template +template Array tvCastToArrayLike(TypedValue tv) { return Array::attach(tvCastToArrayLikeData(tv)); } -template Array tvCastToArrayLike(TypedValue); -template Array tvCastToArrayLike(TypedValue); +template Array tvCastToArrayLike(TypedValue); +template Array tvCastToArrayLike(TypedValue); template static enable_if_lval_t< @@ -674,7 +674,7 @@ enable_if_lval_t tvCastToShapeInPlace(T tv) { assign(tv, ad->toShape(ad->cowCheck())); } -template +template enable_if_lval_t tvCastToArrayInPlace(T tv) { assertx(tvIsPlausible(*tv)); tvUnboxIfNeeded(tv); @@ -719,10 +719,10 @@ enable_if_lval_t tvCastToArrayInPlace(T tv) { auto* adIn = val(tv).parr; assertx(adIn->isDict()); - if (IC == IntishCast::CastSilently) { + if (IC == IntishCast::Cast) { a = MixedArray::ToPHPArrayIntishCastDict(adIn, true); } else { - assertx(IC == IntishCast::AllowCastAndWarn); + assertx(IC == IntishCast::None); a = MixedArray::ToPHPArrayDict(adIn, true); } @@ -734,10 +734,10 @@ enable_if_lval_t tvCastToArrayInPlace(T tv) { auto* adIn = val(tv).parr; assertx(adIn->isDict()); - if (IC == IntishCast::CastSilently) { + if (IC == IntishCast::Cast) { a = MixedArray::ToPHPArrayIntishCastDict(adIn, adIn->cowCheck()); } else { - assertx(IC == IntishCast::AllowCastAndWarn); + assertx(IC == IntishCast::None); a = MixedArray::ToPHPArrayDict(adIn, adIn->cowCheck()); } @@ -749,10 +749,10 @@ enable_if_lval_t tvCastToArrayInPlace(T tv) { auto* adIn = val(tv).parr; assertx(adIn->isKeyset()); - if (IC == IntishCast::CastSilently) { + if (IC == IntishCast::Cast) { a = SetArray::ToPHPArrayIntishCast(adIn, true); } else { - assertx(IC == IntishCast::AllowCastAndWarn); + assertx(IC == IntishCast::None); a = SetArray::ToPHPArray(adIn, true); } @@ -764,10 +764,10 @@ enable_if_lval_t tvCastToArrayInPlace(T tv) { auto* adIn = val(tv).parr; assertx(adIn->isKeyset()); - if (IC == IntishCast::CastSilently) { + if (IC == IntishCast::Cast) { a = SetArray::ToPHPArrayIntishCast(adIn, adIn->cowCheck()); } else { - assertx(IC == IntishCast::AllowCastAndWarn); + assertx(IC == IntishCast::None); a = SetArray::ToPHPArray(adIn, adIn->cowCheck()); } @@ -794,10 +794,10 @@ enable_if_lval_t tvCastToArrayInPlace(T tv) { case KindOfPersistentArray: { auto* adIn = val(tv).parr; assertx(adIn->isPHPArray()); - if (IC == IntishCast::CastSilently) { + if (IC == IntishCast::Cast) { a = adIn->toPHPArrayIntishCast(true); } else { - assertx(IC == IntishCast::AllowCastAndWarn); + assertx(IC == IntishCast::None); a = adIn->toPHPArray(true); } continue; @@ -806,10 +806,10 @@ enable_if_lval_t tvCastToArrayInPlace(T tv) { case KindOfArray: { auto* adIn = val(tv).parr; assertx(adIn->isPHPArray()); - if (IC == IntishCast::CastSilently) { + if (IC == IntishCast::Cast) { a = adIn->toPHPArrayIntishCast(adIn->cowCheck()); } else { - assertx(IC == IntishCast::AllowCastAndWarn); + assertx(IC == IntishCast::None); a = adIn->toPHPArray(adIn->cowCheck()); } if (a != adIn) tvDecRefArr(tv); @@ -1880,7 +1880,7 @@ enable_if_lval_t tvCoerceParamToShapeInPlace(T tv, bool builtin) { not_reached(); } -template +template enable_if_lval_t tvCoerceParamToArrayInPlace(T tv, bool /*builtin*/) { assertx(tvIsPlausible(*tv)); tvUnboxIfNeeded(tv); @@ -2139,8 +2139,8 @@ template bool tvCoerceParamTo##kind##InPlace( \ tv_lval, bool); \ template bool tvCoerceParamTo##kind##InPlace( \ arr_lval, bool); -Y(Array, IntishCast::CastSilently) -Y(Array, IntishCast::AllowCastAndWarn) +Y(Array, IntishCast::Cast) +Y(Array, IntishCast::None) #undef Y #undef X } diff --git a/hphp/runtime/base/tv-conversions.h b/hphp/runtime/base/tv-conversions.h index f0bd6232e9f..ea3b7d97128 100644 --- a/hphp/runtime/base/tv-conversions.h +++ b/hphp/runtime/base/tv-conversions.h @@ -47,9 +47,9 @@ enable_if_lval_t tvCastTo##kind##InPlace(T tv); \ template \ enable_if_lval_t tvCoerceParamTo##kind##InPlace(T tv, bool builtin); #define Y(kind) \ -template \ +template \ enable_if_lval_t tvCastTo##kind##InPlace(T tv); \ -template \ +template \ enable_if_lval_t tvCoerceParamTo##kind##InPlace(T tv, bool builtin); X(Boolean) X(Int64) @@ -119,13 +119,13 @@ bool tvCastToBoolean(TypedValue tv); int64_t tvCastToInt64(TypedValue tv); double tvCastToDouble(TypedValue tv); String tvCastToString(TypedValue tv); -template +template Array tvCastToArrayLike(TypedValue tv); Object tvCastToObject(TypedValue tv); StringData* tvCastToStringData(TypedValue tv); StringData* cellCastToStringData(Cell c); -template +template ArrayData* tvCastToArrayLikeData(TypedValue tv); ObjectData* tvCastToObjectData(TypedValue tv); @@ -139,9 +139,9 @@ double cellToDouble(Cell); /* * Convert `tv' or `cell' to a valid array key for `ad', or throw an exception. */ -template +template Cell cellToKey(Cell cell, const ArrayData* ad); -template +template Cell tvToKey(TypedValue tv, const ArrayData* ad); /* diff --git a/hphp/runtime/base/type-array.cpp b/hphp/runtime/base/type-array.cpp index 91952809f15..56fa456a625 100644 --- a/hphp/runtime/base/type-array.cpp +++ b/hphp/runtime/base/type-array.cpp @@ -194,7 +194,7 @@ Array Array::diffImpl(const Array& array, bool by_key, bool by_value, bool match Variant key(iter.first()); auto const value = iter.secondVal(); bool found = false; - if (array->exists(array.convertKey(key))) { + if (array->exists(array.convertKey(key))) { if (by_value) { found = value_cmp_as_string_function( VarNR(value), diff --git a/hphp/runtime/base/type-array.h b/hphp/runtime/base/type-array.h index 5219b418575..73ce8580699 100644 --- a/hphp/runtime/base/type-array.h +++ b/hphp/runtime/base/type-array.h @@ -32,7 +32,7 @@ namespace HPHP { /////////////////////////////////////////////////////////////////////////////// // Forward declare to avoid including tv-conversions.h and creating a cycle. -template +template ArrayData* tvCastToArrayLikeData(TypedValue tv); struct ArrayIter; @@ -258,9 +258,9 @@ public: /* * Converts `k' to a valid key for this array kind. */ - template + template Cell convertKey(Cell k) const; - template + template Cell convertKey(const Variant& k) const; /* @@ -691,7 +691,7 @@ ALWAYS_INLINE const Array& toCArrRef(tv_rval tv) { return asCArrRef(tvIsRef(tv) ? val(tv).pref->cell() : tv); } -template +template ALWAYS_INLINE Array toArray(tv_rval rval) { if (isArrayLikeType(type(rval))) { return Array{assert_not_null(val(rval).parr)}; diff --git a/hphp/runtime/base/type-variant.h b/hphp/runtime/base/type-variant.h index 1e919d63e1a..0c5cd5b0295 100644 --- a/hphp/runtime/base/type-variant.h +++ b/hphp/runtime/base/type-variant.h @@ -1090,7 +1090,7 @@ struct Variant : private TypedValue { // Convert a non-array-like type to a PHP array, leaving PHP arrays and Hack // arrays unchanged. Use toPHPArray() if you want the result to always be a // PHP array. - template + template Array toArray() const { return HPHP::toArray(asTypedValue()); } @@ -1184,7 +1184,7 @@ struct Variant : private TypedValue { * Convert to a valid key or throw an exception. If convertStrKeys is true * int-like string keys will be converted to int keys. */ - template + template VarNR toKey(const ArrayData*) const; /* Creating a temporary Array, String, or Object with no ref-counting and diff --git a/hphp/runtime/ext/array/ext_array.cpp b/hphp/runtime/ext/array/ext_array.cpp index 662dbdcb02f..dc46a2bec1f 100644 --- a/hphp/runtime/ext/array/ext_array.cpp +++ b/hphp/runtime/ext/array/ext_array.cpp @@ -142,7 +142,7 @@ TypedValue HHVM_FUNCTION(array_column, for (ArrayIter it(arr_input); it; ++it) { Array sub; if (UNLIKELY(RuntimeOption::PHP7_Builtins && it.second().isObject())) { - sub = it.second().toObject().get()->toArray(); + sub = it.second().toObject().get()->toArray(); } else if (it.second().isArray()) { sub = it.second().toArray(); } else { @@ -153,7 +153,7 @@ TypedValue HHVM_FUNCTION(array_column, if (val.isNull()) { elem = sub; } else { - auto const val_key = sub.convertKey(val); + auto const val_key = sub.convertKey(val); if (sub.exists(val_key)) { elem = sub[val_key]; } else { @@ -164,14 +164,14 @@ TypedValue HHVM_FUNCTION(array_column, if (idx.isNull()) { ret.append(elem); } else { - auto const idx_key = sub.convertKey(idx); + auto const idx_key = sub.convertKey(idx); if (!sub.exists(idx_key)) { ret.append(elem); } else if (sub[idx_key].isObject()) { - ret.setUnknownKey(sub[idx_key].toString(), + ret.setUnknownKey(sub[idx_key].toString(), elem); } else { - ret.setUnknownKey(sub[idx_key], elem); + ret.setUnknownKey(sub[idx_key], elem); } } } @@ -200,10 +200,10 @@ TypedValue HHVM_FUNCTION(array_combine, iter1; ++iter1, ++iter2) { auto const key = iter1.secondRvalPlus().unboxed(); if (key.type() == KindOfInt64 || isStringType(key.type())) { - ret.setWithRef(ret.convertKey(key.tv()), + ret.setWithRef(ret.convertKey(key.tv()), iter2.secondValPlus()); } else { - ret.setWithRef(ret.convertKey(tvCastToString(key.tv())), + ret.setWithRef(ret.convertKey(tvCastToString(key.tv())), iter2.secondValPlus()); } } @@ -224,7 +224,7 @@ TypedValue HHVM_FUNCTION(array_count_values, input.asCArrRef() // If this isn't exactly an Array, then it must be a hack collection, // so it is safe to get the object data - : collections::toArray( + : collections::toArray( input.getObjectData() ))); } @@ -241,12 +241,12 @@ TypedValue HHVM_FUNCTION(array_fill_keys, [&](TypedValue v) { auto const inner = tvToCell(v); if (isIntType(inner.m_type) || isStringType(inner.m_type)) { - ai->setUnknownKey(VarNR(inner), value); + ai->setUnknownKey(VarNR(inner), value); } else { raise_hack_strict(RuntimeOption::StrictArrayFillKeys, "strict_array_fill_keys", "keys must be ints or strings"); - ai->setUnknownKey(tvCastToString(v), value); + ai->setUnknownKey(tvCastToString(v), value); } }, [&](ObjectData* coll) { @@ -306,7 +306,7 @@ TypedValue HHVM_FUNCTION(array_flip, auto const inner = iter.secondRvalPlus().unboxed(); if (inner.type() == KindOfInt64 || isStringType(inner.type()) || isFuncType(inner.type())|| isClassType(inner.type())) { - ret.setUnknownKey(VarNR(inner.tv()), + ret.setUnknownKey(VarNR(inner.tv()), iter.first()); } else { raise_warning("Can only flip STRING and INTEGER values!"); @@ -451,13 +451,13 @@ static void php_array_merge_recursive(PointerSet &seen, bool check, // There is no need to do toKey() conversion, for a key that is already // in the array. auto const arrkey = - arr1.convertKey(*key.asTypedValue()); + arr1.convertKey(*key.asTypedValue()); auto const lval = arr1.lvalAt(arrkey, AccessFlags::Key); - auto subarr1 = tvCastToArrayLike(lval.tv()) + auto subarr1 = tvCastToArrayLike(lval.tv()) .toPHPArray(); php_array_merge_recursive( seen, couldRecur(lval, subarr1.get()), subarr1, - tvCastToArrayLike(iter.secondVal()) + tvCastToArrayLike(iter.secondVal()) ); tvUnset(lval); // avoid contamination of the value that was strongly bound tvSet(make_tv(subarr1.get()), lval); @@ -644,12 +644,12 @@ static void php_array_replace_recursive(PointerSet &seen, bool check, for (ArrayIter iter(arr2); iter; ++iter) { const auto key = - Variant::wrap(arr1.convertKey(iter.first())); + Variant::wrap(arr1.convertKey(iter.first())); auto const rval = iter.secondRval().unboxed(); if (arr1.exists(key, true) && isArrayLikeType(rval.type())) { auto const lval = arr1.lvalAt(key, AccessFlags::Key); if (isArrayLikeType(lval.unboxed().type())) { - Array subarr1 = tvCastToArrayLike( + Array subarr1 = tvCastToArrayLike( lval.tv() ).toPHPArrayIntishCast(); php_array_replace_recursive(seen, couldRecur(lval, subarr1.get()), @@ -1000,7 +1000,7 @@ TypedValue HHVM_FUNCTION(array_slice, return tvReturn(ArrNR{cell_input.m_data.parr} .asArray().toPHPArrayIntishCast()); } - return tvReturn(cell_input.m_data.pobj->toArray()); + return tvReturn(cell_input.m_data.pobj->toArray()); } int pos = 0; @@ -1805,7 +1805,7 @@ static inline bool checkIsClsMethAndRaise( if (isArrayLikeType(c1.m_type)) { \ return tvReturn(container1); \ } else { \ - return tvReturn(container1.toArray()); \ + return tvReturn(container1.toArray()); \ } \ } \ Array ret = Array::Create(); @@ -1838,7 +1838,7 @@ TypedValue HHVM_FUNCTION(array_diff, if (checkSetHelper(st, c, strTv, true)) continue; const auto key = isKey ? *iter.first().asTypedValue() - : ret.convertKey(iter.first()); + : ret.convertKey(iter.first()); ret.setWithRef(key, iter.secondValPlus(), true); } return tvReturn(std::move(ret)); @@ -1893,7 +1893,7 @@ TypedValue HHVM_FUNCTION(array_diff_key, if (checkSetHelper(st, c, strTv, !isKey)) continue; const auto arrkey = isKey ? c - : ret.convertKey(key); + : ret.convertKey(key); ret.setWithRef(arrkey, iter.secondValPlus(), true); } return tvReturn(std::move(ret)); @@ -2246,7 +2246,7 @@ TypedValue HHVM_FUNCTION(array_intersect, if (!checkSetHelper(st, c, strTv, true)) continue; const auto key = isKey ? iter.first() - : Variant::wrap(ret.convertKey(iter.first())); + : Variant::wrap(ret.convertKey(iter.first())); ret.setWithRef(key, iter.secondValPlus(), true); } return tvReturn(std::move(ret)); @@ -2308,7 +2308,7 @@ TypedValue HHVM_FUNCTION(array_intersect_key, if (!checkSetHelper(st, c, strTv, !isKey)) continue; auto arrkey = isKey ? key - : Variant::wrap(ret.convertKey(key)); + : Variant::wrap(ret.convertKey(key)); ret.setWithRef(arrkey, iter.secondValPlus(), true); } return tvReturn(std::move(ret)); diff --git a/hphp/runtime/ext/array/ext_array.h b/hphp/runtime/ext/array/ext_array.h index c9b68fb9caf..97b14f31c08 100644 --- a/hphp/runtime/ext/array/ext_array.h +++ b/hphp/runtime/ext/array/ext_array.h @@ -278,11 +278,11 @@ inline int64_t countHelper(TypedValue tv) { return make_tv(); \ } \ Variant var_##input(input); \ - tvCastToArrayInPlace( \ + tvCastToArrayInPlace( \ var_##input.asTypedValue() \ ); \ assertx(var_##input.isArray()); \ - auto arr_##input = var_##input.toArray(); + auto arr_##input = var_##input.toArray(); #define getCheckedArray(input) \ getCheckedArrayRet(input, make_tv()) diff --git a/hphp/runtime/ext/collections/ext_collections-map.cpp b/hphp/runtime/ext/collections/ext_collections-map.cpp index cc66542ed12..7dac7f55d52 100644 --- a/hphp/runtime/ext/collections/ext_collections-map.cpp +++ b/hphp/runtime/ext/collections/ext_collections-map.cpp @@ -249,7 +249,7 @@ Array BaseMap::toPHPArray() { if (RuntimeOption::EvalHackArrCompatArrayProducingFuncNotices) { raise_hack_arr_compat_array_producing_func_notice("Map::toArray"); } - return toPHPArrayImpl(); + return toPHPArrayImpl(); } template diff --git a/hphp/runtime/ext/collections/ext_collections-map.h b/hphp/runtime/ext/collections/ext_collections-map.h index 0a6d02cfc4c..39d18b71e34 100644 --- a/hphp/runtime/ext/collections/ext_collections-map.h +++ b/hphp/runtime/ext/collections/ext_collections-map.h @@ -87,7 +87,7 @@ public: Array toPHPArray(); public: - template + template static Array ToArray(const ObjectData* obj) { check_collection_cast_to_array(); return const_cast( diff --git a/hphp/runtime/ext/collections/ext_collections-pair.h b/hphp/runtime/ext/collections/ext_collections-pair.h index 8fc85db50c6..d57399b2e45 100644 --- a/hphp/runtime/ext/collections/ext_collections-pair.h +++ b/hphp/runtime/ext/collections/ext_collections-pair.h @@ -78,7 +78,7 @@ struct c_Pair : ObjectData { assertx(obj->getVMClass() == c_Pair::classof()); return true; } - template + template static Array ToArray(const ObjectData* obj) { auto pair = static_cast(obj); check_collection_cast_to_array(); diff --git a/hphp/runtime/ext/collections/ext_collections-set.cpp b/hphp/runtime/ext/collections/ext_collections-set.cpp index a27850cdd41..033396f5288 100644 --- a/hphp/runtime/ext/collections/ext_collections-set.cpp +++ b/hphp/runtime/ext/collections/ext_collections-set.cpp @@ -255,7 +255,7 @@ Array BaseSet::toPHPArray() { if (RuntimeOption::EvalHackArrCompatArrayProducingFuncNotices) { raise_hack_arr_compat_array_producing_func_notice("Set::toArray"); } - return toPHPArrayImpl(); + return toPHPArrayImpl(); } Variant BaseSet::firstValue() { diff --git a/hphp/runtime/ext/collections/ext_collections-set.h b/hphp/runtime/ext/collections/ext_collections-set.h index bb18d99eeaa..86712c5f7f2 100644 --- a/hphp/runtime/ext/collections/ext_collections-set.h +++ b/hphp/runtime/ext/collections/ext_collections-set.h @@ -94,7 +94,7 @@ public: std::is_base_of::value, TSet*>::type static Clone(ObjectData* obj); - template + template static Array ToArray(const ObjectData* obj) { check_collection_cast_to_array(); return const_cast( diff --git a/hphp/runtime/ext/collections/ext_collections-vector.h b/hphp/runtime/ext/collections/ext_collections-vector.h index c44540e7d00..b5c290650ec 100644 --- a/hphp/runtime/ext/collections/ext_collections-vector.h +++ b/hphp/runtime/ext/collections/ext_collections-vector.h @@ -131,7 +131,7 @@ public: return &data()[k]; } - template + template static Array ToArray(const ObjectData* obj) { check_collection_cast_to_array(); return const_cast( diff --git a/hphp/runtime/ext/collections/hash-collection.h b/hphp/runtime/ext/collections/hash-collection.h index 25916676591..9e8c1ca8b96 100644 --- a/hphp/runtime/ext/collections/hash-collection.h +++ b/hphp/runtime/ext/collections/hash-collection.h @@ -48,16 +48,16 @@ struct HashCollection : ObjectData { Array toArray() = delete; - template + template Array toPHPArrayImpl() { if (!m_size) { return empty_array(); } ArrayData* ad; - if (intishCast == IntishCast::AllowCastAndWarn) { + if (intishCast == IntishCast::None) { ad = arrayData()->toPHPArray(true); - } else if (intishCast == IntishCast::CastSilently) { + } else if (intishCast == IntishCast::Cast) { ad = arrayData()->toPHPArrayIntishCast(true); } else { always_assert(false); diff --git a/hphp/runtime/ext/fb/VariantController.h b/hphp/runtime/ext/fb/VariantController.h index cfb1a5430b4..2bb180a1671 100644 --- a/hphp/runtime/ext/fb/VariantController.h +++ b/hphp/runtime/ext/fb/VariantController.h @@ -138,7 +138,7 @@ struct VariantControllerImpl { } static void mapSet(MapType& map, StringType&& k, VariantType&& v) { - auto const arrkey = map.convertKey(k); + auto const arrkey = map.convertKey(k); Variant val(std::move(v)); map.set(arrkey, *val.asTypedValue()); } @@ -149,7 +149,7 @@ struct VariantControllerImpl { template static void mapSet(ArrayInit& map, Key&& k, VariantType&& v) { - map.setUnknownKey(std::move(k), std::move(v)); + map.setUnknownKey(std::move(k), std::move(v)); } static int64_t mapSize(const MapType& map) { return map.size(); } static ArrayIter mapIterator(const MapType& map) { diff --git a/hphp/runtime/ext/fb/ext_fb.cpp b/hphp/runtime/ext/fb/ext_fb.cpp index 02374b95d11..780f41e9b0f 100644 --- a/hphp/runtime/ext/fb/ext_fb.cpp +++ b/hphp/runtime/ext/fb/ext_fb.cpp @@ -794,7 +794,7 @@ int fb_compact_unserialize_from_buffer( arr.set(key.toInt64(), value); } else if (key.getType() == KindOfString || key.getType() == KindOfPersistentString) { - const auto arrkey = arr.convertKey(key); + const auto arrkey = arr.convertKey(key); arr.set(arrkey, *value.asTypedValue()); } else { return FB_UNSERIALIZE_UNEXPECTED_ARRAY_KEY_TYPE; diff --git a/hphp/runtime/ext/mailparse/mime.cpp b/hphp/runtime/ext/mailparse/mime.cpp index b05107bae79..92bab653a0e 100644 --- a/hphp/runtime/ext/mailparse/mime.cpp +++ b/hphp/runtime/ext/mailparse/mime.cpp @@ -165,7 +165,7 @@ MimePart::MimeHeader::MimeHeader(php_rfc822_tokenized_t *toks) rfc2231_to_mime(value_buf, NULL, 0, prevcharset_p); auto const name_key = - m_attributes.convertKey(name_buf); + m_attributes.convertKey(name_buf); auto str = value_buf.detach(); m_attributes.set(name_key, make_tv(str.get())); value_buf.clear(); @@ -178,7 +178,7 @@ MimePart::MimeHeader::MimeHeader(php_rfc822_tokenized_t *toks) if (!currentencoded) { /* Add string*/ auto const updated_name_key = - m_attributes.convertKey(name); + m_attributes.convertKey(name); m_attributes.set(updated_name_key, make_tv(value.get())); } else { /* Encoded name changed*/ @@ -198,7 +198,7 @@ MimePart::MimeHeader::MimeHeader(php_rfc822_tokenized_t *toks) } } else { auto const name_key = - m_attributes.convertKey(name); + m_attributes.convertKey(name); m_attributes.set(name_key, make_tv(value.get())); } } @@ -216,7 +216,7 @@ MimePart::MimeHeader::MimeHeader(php_rfc822_tokenized_t *toks) /* Finalize packet */ rfc2231_to_mime(value_buf, NULL, 0, prevcharset_p); auto const name_key = - m_attributes.convertKey(name_buf); + m_attributes.convertKey(name_buf); auto str = value_buf.detach(); m_attributes.set(name_key, make_tv(str.get())); } @@ -230,7 +230,7 @@ void MimePart::MimeHeader::clear() { Variant MimePart::MimeHeader::get(const String& attrname) { auto const arrkey = - m_attributes.convertKey(attrname); + m_attributes.convertKey(attrname); return m_attributes[arrkey]; } @@ -238,7 +238,7 @@ void MimePart::MimeHeader::getAll(Array &ret, const String& valuelabel, const String& attrprefix) { for (ArrayIter iter(m_attributes); iter; ++iter) { String s = attrprefix + iter.first().toString(); - auto const arrkey = ret.convertKey(s); + auto const arrkey = ret.convertKey(s); ret.set(arrkey, iter.secondVal()); } @@ -250,7 +250,7 @@ void MimePart::MimeHeader::getAll(Array &ret, const String& valuelabel, * doesn't overwrite content-type with the type="text/html" * value. * */ - auto const arrkey = ret.convertKey(valuelabel); + auto const arrkey = ret.convertKey(valuelabel); ret.set(arrkey, make_tv(m_value.get())); } @@ -686,7 +686,7 @@ bool MimePart::processHeader() { } auto const header_arrkey = - m_headers.convertKey(header_key); + m_headers.convertKey(header_key); /* add the header to the hash. * join multiple To: or Cc: lines together */ if ((header_key == s_to || header_key == s_cc) && diff --git a/hphp/runtime/ext/mysql/mysql_common.cpp b/hphp/runtime/ext/mysql/mysql_common.cpp index 791e6ade6d1..3647f692e54 100644 --- a/hphp/runtime/ext/mysql/mysql_common.cpp +++ b/hphp/runtime/ext/mysql/mysql_common.cpp @@ -1669,7 +1669,7 @@ Variant php_mysql_fetch_hash(const Resource& result, int result_type) { if (result_type & PHP_MYSQL_ASSOC) { MySQLFieldInfo *info = res->getFieldInfo(i); auto const arrkey = - ret.convertKey(info->name); + ret.convertKey(info->name); ret.set(arrkey, *res->getField(i).asTypedValue()); } } @@ -1702,7 +1702,7 @@ Variant php_mysql_fetch_hash(const Resource& result, int result_type) { } if (result_type & PHP_MYSQL_ASSOC) { String str(mysql_field->name, CopyString); - auto const array_key = ret.convertKey(str); + auto const array_key = ret.convertKey(str); ret.set(array_key, *data.asTypedValue()); } } diff --git a/hphp/runtime/ext/pdo/ext_pdo.cpp b/hphp/runtime/ext/pdo/ext_pdo.cpp index c7f80ed34a5..7e7f9638326 100644 --- a/hphp/runtime/ext/pdo/ext_pdo.cpp +++ b/hphp/runtime/ext/pdo/ext_pdo.cpp @@ -610,7 +610,7 @@ static bool pdo_stmt_describe_columns(sp_PDOStatement stmt) { } auto const column_key = - stmt->bound_columns.convertKey(column->name); + stmt->bound_columns.convertKey(column->name); if (stmt->bound_columns.exists(column_key)) { auto param = cast(stmt->bound_columns[column_key]); param->paramno = col; @@ -1896,7 +1896,7 @@ static bool do_fetch(sp_PDOStatement stmt, switch (how) { case PDO_FETCH_ASSOC: { auto const name_key = - ret.toArrRef().convertKey(name); + ret.toArrRef().convertKey(name); ret.toArrRef().set(name_key, *val.asTypedValue()); break; } @@ -1905,11 +1905,11 @@ static bool do_fetch(sp_PDOStatement stmt, fetch_value(stmt, tmp, ++i, NULL); if (return_all) { auto const val_key_ret = - return_all->toArrRef().convertKey(val); + return_all->toArrRef().convertKey(val); return_all->toArrRef().set(val_key_ret, *tmp.asTypedValue()); } else { auto const val_key = - ret.toArrRef().convertKey(val); + ret.toArrRef().convertKey(val); ret.toArrRef().set(val_key, *tmp.asTypedValue()); } return true; @@ -1917,7 +1917,7 @@ static bool do_fetch(sp_PDOStatement stmt, case PDO_FETCH_USE_DEFAULT: case PDO_FETCH_BOTH: { auto const name_key = - ret.toArrRef().convertKey(name); + ret.toArrRef().convertKey(name); ret.toArrRef().set(name_key, *val.asTypedValue()); ret.toArrRef().append(val); break; @@ -1925,7 +1925,7 @@ static bool do_fetch(sp_PDOStatement stmt, case PDO_FETCH_NAMED: { auto const name_key = - ret.toArrRef().convertKey(name); + ret.toArrRef().convertKey(name); /* already have an item with this name? */ forceToDArray(ret); if (ret.toArrRef().exists(name_key)) { @@ -2005,7 +2005,7 @@ static bool do_fetch(sp_PDOStatement stmt, if (return_all) { auto const grp_key = - return_all->toArrRef().convertKey(grp_val); + return_all->toArrRef().convertKey(grp_val); if ((flags & PDO_FETCH_UNIQUE) == PDO_FETCH_UNIQUE) { return_all->toArrRef().set(grp_key, *ret.asTypedValue()); } else { @@ -2469,7 +2469,7 @@ safe: vparam = params[plc->bindno]; } else { String str(plc->pos, plc->len, CopyString); - auto const arrkey = params.convertKey(str); + auto const arrkey = params.convertKey(str); vparam = params[arrkey]; } if (vparam.isNull()) { @@ -2598,7 +2598,7 @@ rewrite: int skip_map = 0; String name(plc->pos, plc->len, CopyString); auto const name_key = - stmt->bound_param_map.convertKey(name); + stmt->bound_param_map.convertKey(name); /* check if bound parameter is already available */ if (!strcmp(name.c_str(), "?") || diff --git a/hphp/runtime/ext/reflection/ext_reflection.cpp b/hphp/runtime/ext/reflection/ext_reflection.cpp index 7d5735ac5b6..e7d00077795 100644 --- a/hphp/runtime/ext/reflection/ext_reflection.cpp +++ b/hphp/runtime/ext/reflection/ext_reflection.cpp @@ -1776,7 +1776,7 @@ static void HHVM_METHOD(ReflectionProperty, __construct, assertx(cls == obj->getVMClass()); if (obj->getAttribute(ObjectData::HasDynPropArr) && obj->dynPropArray().exists( - obj->dynPropArray().convertKey(prop_name)) + obj->dynPropArray().convertKey(prop_name)) ){ if (RuntimeOption::EvalNoticeOnReadDynamicProp) { obj->raiseReadDynamicProp(prop_name.get()); diff --git a/hphp/runtime/ext/string/ext_string.cpp b/hphp/runtime/ext/string/ext_string.cpp index b126081052c..b70b2ac046e 100644 --- a/hphp/runtime/ext/string/ext_string.cpp +++ b/hphp/runtime/ext/string/ext_string.cpp @@ -2023,7 +2023,7 @@ bool strtr_slow(const Array& arr, StringBuffer& result, String& key, for (int len = maxlen; len >= minlen; len--) { key.setSize(len); auto const key_tval = make_tv(key.get()); - auto const arrkey = arr.convertKey(key_tval); + auto const arrkey = arr.convertKey(key_tval); auto const rval = arr->get(arrkey); if (!rval.is_dummy()) { String replace = tvCastToString(rval.tv()); diff --git a/hphp/runtime/ext/thrift/binary.cpp b/hphp/runtime/ext/thrift/binary.cpp index 88e5fae2ae6..96279f86352 100644 --- a/hphp/runtime/ext/thrift/binary.cpp +++ b/hphp/runtime/ext/thrift/binary.cpp @@ -568,7 +568,7 @@ void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, transport.writeString(sv.data(), sv.size()); } return; case T_MAP: { - Array ht = value.toArray(); + Array ht = value.toArray(); uint8_t keytype = (char)tvCastToInt64( fieldspec.rvalAt(s_ktype, AccessFlags::ErrorKey).tv() ); @@ -589,7 +589,7 @@ void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, } } return; case T_LIST: { - Array ht = value.toArray(); + Array ht = value.toArray(); Variant val; uint8_t valtype = tvCastToInt64( @@ -605,7 +605,7 @@ void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, } } return; case T_SET: { - Array ht = value.toArray(); + Array ht = value.toArray(); uint8_t keytype = (char)tvCastToInt64( fieldspec.rvalAt(s_etype, AccessFlags::ErrorKey).tv() diff --git a/hphp/runtime/server/http-protocol.cpp b/hphp/runtime/server/http-protocol.cpp index 1dd54a6656d..54528468324 100644 --- a/hphp/runtime/server/http-protocol.cpp +++ b/hphp/runtime/server/http-protocol.cpp @@ -73,7 +73,7 @@ static void CopyParams(Array& dest, const Array& src) { src.get(), [&](Cell k, TypedValue v) { const auto arraykey = - dest.convertKey(k); + dest.convertKey(k); dest.set(arraykey, v, true); } ); @@ -202,7 +202,7 @@ static void PrepareEnv(Array& env, Transport *transport) { String key(header.first); String value(header.second.back()); g_context->setenv(key, value); - env.set(env.convertKey(key), + env.set(env.convertKey(key), make_tv(value.get())); } } @@ -791,14 +791,14 @@ void HttpProtocol::PrepareServerVariable(Array& server, for (auto& kv : RuntimeOption::ServerVariables) { String idx(kv.first); const auto arrkey = - server.convertKey(idx); + server.convertKey(idx); String str(kv.second); server.set(arrkey, make_tv(str.get()), true); } for (auto& kv : vhost->getServerVars()) { String idx(kv.first); const auto arrkey = - server.convertKey(idx); + server.convertKey(idx); String str(kv.second); server.set(arrkey, make_tv(str.get()), true); } diff --git a/hphp/runtime/server/source-root-info.cpp b/hphp/runtime/server/source-root-info.cpp index 6215ae87c90..b6f3d2bf86d 100644 --- a/hphp/runtime/server/source-root-info.cpp +++ b/hphp/runtime/server/source-root-info.cpp @@ -220,7 +220,7 @@ Array SourceRootInfo::setServerVariables(Array server) const { it != RuntimeOption::SandboxServerVariables.end(); ++it) { String idx(it->first); - const auto arrkey = server.convertKey(idx); + const auto arrkey = server.convertKey(idx); String str(parseSandboxServerVariable(it->second)); server.set(arrkey, make_tv(str.get()), true); } -- 2.11.4.GIT