Remove Variant's o_foo member functions @override-unit-failures
Esse commit está contido em:
@@ -172,10 +172,6 @@ public:
|
||||
bool less (CObjRef v2) const;
|
||||
bool more (CObjRef v2) const;
|
||||
|
||||
/**
|
||||
* Unresolved objects will go through these two functions than the ones
|
||||
* on SmartObject<T>.
|
||||
*/
|
||||
Variant o_get(CStrRef propName, bool error = true,
|
||||
CStrRef context = null_string) const;
|
||||
Variant o_set(CStrRef s, CVarRef v, CStrRef context = null_string);
|
||||
|
||||
@@ -2072,71 +2072,6 @@ Variant &Variant::lvalBlackHole() {
|
||||
return bh;
|
||||
}
|
||||
|
||||
Variant Variant::o_get(CStrRef propName, bool error /* = true */,
|
||||
CStrRef context /* = null_string */) const {
|
||||
if (m_type == KindOfObject) {
|
||||
return m_data.pobj->o_get(propName, error, context);
|
||||
} else if (m_type == KindOfRef) {
|
||||
return m_data.pref->var()->o_get(propName, error, context);
|
||||
} else if (error) {
|
||||
raise_notice("Trying to get property of non-object");
|
||||
}
|
||||
return null_variant;
|
||||
}
|
||||
|
||||
Variant Variant::o_set(CStrRef propName, CVarRef val,
|
||||
CStrRef context /* = null_string */) {
|
||||
if (m_type == KindOfObject) {
|
||||
} else if (m_type == KindOfRef) {
|
||||
return m_data.pref->var()->o_set(propName, val, context);
|
||||
} else if (isObjectConvertable()) {
|
||||
setToDefaultObject();
|
||||
} else {
|
||||
// Raise a warning
|
||||
raise_warning("Attempt to assign property of non-object");
|
||||
return uninit_null();
|
||||
}
|
||||
return m_data.pobj->o_set(propName, val, context);
|
||||
}
|
||||
|
||||
Variant Variant::o_setRef(CStrRef propName, CVarRef val,
|
||||
CStrRef context /* = null_string */) {
|
||||
if (m_type == KindOfObject) {
|
||||
} else if (m_type == KindOfRef) {
|
||||
return m_data.pref->var()->o_setRef(propName, val, context);
|
||||
} else if (isObjectConvertable()) {
|
||||
setToDefaultObject();
|
||||
} else {
|
||||
// Raise a warning
|
||||
raise_warning("Attempt to assign property of non-object");
|
||||
return uninit_null();
|
||||
}
|
||||
return m_data.pobj->o_setRef(propName, val, context);
|
||||
}
|
||||
|
||||
Variant Variant::o_invoke(CStrRef s, CArrRef params) {
|
||||
if (m_type == KindOfObject) {
|
||||
return m_data.pobj->o_invoke(s, params);
|
||||
} else if (m_type == KindOfRef) {
|
||||
return m_data.pref->var()->o_invoke(s, params);
|
||||
} else {
|
||||
throw_call_non_object(s.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Variant Variant::o_invoke_few_args(CStrRef s, int count,
|
||||
INVOKE_FEW_ARGS_IMPL_ARGS) {
|
||||
if (m_type == KindOfObject) {
|
||||
return m_data.pobj->o_invoke_few_args(s, count,
|
||||
INVOKE_FEW_ARGS_PASS_ARGS);
|
||||
} else if (m_type == KindOfRef) {
|
||||
return m_data.pref->var()->o_invoke_few_args(s, count,
|
||||
INVOKE_FEW_ARGS_PASS_ARGS);
|
||||
} else {
|
||||
throw_call_non_object(s.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline ALWAYS_INLINE CVarRef Variant::SetImpl(Variant *self, T key,
|
||||
CVarRef v, bool isKey) {
|
||||
|
||||
@@ -828,18 +828,6 @@ class Variant : private TypedValue {
|
||||
Variant &lvalRef(CStrRef key, Variant& tmp, ACCESSPARAMS_DECL);
|
||||
Variant &lvalRef(CVarRef key, Variant& tmp, ACCESSPARAMS_DECL);
|
||||
|
||||
Variant o_get(CStrRef propName, bool error = true,
|
||||
CStrRef context = null_string) const;
|
||||
Variant o_set(CStrRef s, CVarRef v, CStrRef context = null_string);
|
||||
Variant o_set(CStrRef s, RefResult v, CStrRef context = null_string) {
|
||||
return o_setRef(s, variant(v), context);
|
||||
}
|
||||
Variant o_setRef(CStrRef s, CVarRef v, CStrRef context = null_string);
|
||||
|
||||
Variant o_invoke(CStrRef s, CArrRef params);
|
||||
Variant o_invoke_few_args(CStrRef s, int count,
|
||||
INVOKE_FEW_ARGS_DECL_ARGS);
|
||||
|
||||
template <typename T>
|
||||
inline ALWAYS_INLINE static CVarRef SetImpl(
|
||||
Variant *self, T key, CVarRef v, bool isKey);
|
||||
|
||||
@@ -347,7 +347,8 @@ String CmdInfo::GetParams(CArrRef params, bool varg,
|
||||
// ClassInfo was not able to serialize the value, so ext_reflection
|
||||
// prepared a stdClass error object. We should fall back to display
|
||||
// the original PHP text, if there.
|
||||
args.append(defValue.o_get(s_msg).toString());
|
||||
Object obj{defValue.asCell()->m_data.pobj};
|
||||
args.append(obj->o_get(s_msg).toString());
|
||||
} else if (detailed) {
|
||||
args.append(DebuggerClient::FormatVariable(arg[s_default], -1));
|
||||
} else {
|
||||
|
||||
@@ -308,50 +308,58 @@ static void set_function_info(Array &ret, const ClassInfo::MethodInfo *info,
|
||||
param.set(s_name, p->name);
|
||||
param.set(s_type, p->type);
|
||||
param.set(s_function, info->name);
|
||||
|
||||
if (classname) {
|
||||
param.set(s_class, VarNR(*classname));
|
||||
}
|
||||
|
||||
const char *defText = p->valueText;
|
||||
int64_t defTextLen = p->valueTextLen;
|
||||
if (defText == nullptr) {
|
||||
defText = "";
|
||||
defTextLen = 0;
|
||||
}
|
||||
|
||||
if (!p->type || !*p->type || !strcasecmp("null", defText)) {
|
||||
param.set(s_nullable, true_varNR);
|
||||
}
|
||||
|
||||
if (p->value && *p->value) {
|
||||
if (*p->value == '\x01') {
|
||||
Variant v;
|
||||
if ((defTextLen > 2) &&
|
||||
!strcmp(defText + defTextLen - 2, "()")) {
|
||||
const char *sep = strchr(defText, ':');
|
||||
v = SystemLib::AllocStdClassObject();
|
||||
Object obj = SystemLib::AllocStdClassObject();
|
||||
if (sep && sep[1] == ':') {
|
||||
String cls = String(defText, sep - defText, CopyString);
|
||||
String con = String(sep + 2, CopyString);
|
||||
v.o_set(s_class, cls);
|
||||
v.o_set(s_name, con);
|
||||
obj->o_set(s_class, cls);
|
||||
obj->o_set(s_name, con);
|
||||
} else {
|
||||
v.o_set(s_name, String(defText, defTextLen, CopyString));
|
||||
obj->o_set(s_name, String(defText, defTextLen, CopyString));
|
||||
}
|
||||
param.set(s_default, v);
|
||||
} else if (resolveDefaultParameterConstant(defText, defTextLen, v)) {
|
||||
param.set(s_default, v);
|
||||
param.set(s_default, Variant(obj));
|
||||
} else {
|
||||
v = SystemLib::AllocStdClassObject();
|
||||
v.o_set(s_msg, String("Unknown unserializable default value: ")
|
||||
+ defText);
|
||||
param.set(s_default, v);
|
||||
Variant v;
|
||||
if (resolveDefaultParameterConstant(defText, defTextLen, v)) {
|
||||
param.set(s_default, v);
|
||||
} else {
|
||||
Object obj = SystemLib::AllocStdClassObject();
|
||||
obj->o_set(s_msg, String("Unknown unserializable default value: ")
|
||||
+ defText);
|
||||
param.set(s_default, Variant(obj));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
param.set(s_default, unserialize_from_string(p->value));
|
||||
}
|
||||
param.set(s_defaultText, defText);
|
||||
}
|
||||
|
||||
if (p->attribute & ClassInfo::IsReference) {
|
||||
param.set(s_ref, true_varNR);
|
||||
}
|
||||
|
||||
{
|
||||
Array userAttrs = Array::Create();
|
||||
for (unsigned int i = 0; i < p->userAttrs.size(); ++i) {
|
||||
|
||||
@@ -580,7 +580,7 @@ bool TestExtMysql::test_mysql_fetch_object() {
|
||||
|
||||
Variant res = f_mysql_query("select * from test");
|
||||
Variant row = f_mysql_fetch_object(res);
|
||||
VS(row.toObject().o_get("name"), "test");
|
||||
VS(row.toObject()->o_get("name"), "test");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
@@ -600,7 +600,7 @@ bool TestExtMysql::test_mysql_fetch_field() {
|
||||
VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true);
|
||||
|
||||
Variant res = f_mysql_query("select * from test");
|
||||
VS(f_mysql_fetch_field(res, 1).o_get("name"), "name");
|
||||
VS(f_mysql_fetch_field(res, 1).toObject()->o_get("name"), "name");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ bool TestExtMysql::test_mysql_field_seek() {
|
||||
|
||||
Variant res = f_mysql_query("select * from test");
|
||||
VERIFY(f_mysql_field_seek(res, 1));
|
||||
VS(f_mysql_fetch_field(res).o_get("name"), "name");
|
||||
VS(f_mysql_fetch_field(res).toObject()->o_get("name"), "name");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário