Fix a bug with null constants
We end up with uninit nulls in the repo for unit constants. In RepoAuthoritative mode, we will use m_type == KindOfUninit during constant lookup to decide whether to cast TypedValue::m_data.pref to a ConstantInfo*, and then call a function pointer that it contains. (We should probably also clean that up to not cast RefData*'s to ConstantInfo*'s, but I left that out of this diff.)
Esse commit está contido em:
@@ -1686,6 +1686,9 @@ void EmitterVisitor::visit(FileScopePtr file) {
|
||||
if (func->isSimpleDefine(&name, &tv)) {
|
||||
UnitMergeKind k = func->isDefineWithoutImpl(ar) ?
|
||||
UnitMergeKindPersistentDefine : UnitMergeKindDefine;
|
||||
if (tv.m_type == KindOfUninit) {
|
||||
tv.m_type = KindOfNull;
|
||||
}
|
||||
m_ue.pushMergeableDef(k, name, tv);
|
||||
visit(s);
|
||||
continue;
|
||||
|
||||
@@ -1273,6 +1273,7 @@ void Unit::mergeImpl(void* tcbase, UnitMergeInfo* mi) {
|
||||
Stats::inc(Stats::UnitMerge_mergeable_define);
|
||||
StringData* name = (StringData*)((char*)obj - (int)k);
|
||||
auto* v = (TypedValueAux*)mi->mergeableData(ix + 1);
|
||||
assert(v->m_type != KindOfUninit);
|
||||
mergeCns(getDataRef<TypedValue>(tcbase, v->cacheHandle()), v, name);
|
||||
ix += 1 + sizeof(*v) / sizeof(void*);
|
||||
obj = mi->mergeableObj(ix);
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
define('FOO', null);
|
||||
Referência em uma Nova Issue
Bloquear um usuário