bool tvCoerceParamToDoubleInPlace(TypedValue* tv) { tvUnboxIfNeeded(tv); if (!tvCanBeCoercedToNumber(tv)) { return false; } tvCastToDoubleInPlace(tv); return true; }
bool tvCoerceParamToInt64InPlace(TypedValue* tv) { assert(tvIsPlausible(*tv)); tvUnboxIfNeeded(tv); if (!tvCanBeCoercedToNumber(tv)) { return false; } tvCastToInt64InPlace(tv); return true; }
bool tvCoerceParamToInt64InPlace(TypedValue* tv) { assert(tvIsPlausible(*tv)); tvUnboxIfNeeded(tv); if (!tvCanBeCoercedToNumber(tv)) { return false; } // In PHP 7 mode doubles only convert to integers when the conversion is non- // narrowing if (RuntimeOption::PHP7_ScalarTypes && tv->m_type == KindOfDouble) { if (tv->m_data.dbl < std::numeric_limits<int64_t>::min()) return false; if (tv->m_data.dbl > std::numeric_limits<int64_t>::max()) return false; if (std::isnan(tv->m_data.dbl)) return false; } tvCastToInt64InPlace(tv); return true; }