Esempio n. 1
0
APCHandle* APCObject::MakeAPCObject(APCHandle* obj, CVarRef value) {
  if (!value.is(KindOfObject) || obj->getObjAttempted()) {
    return nullptr;
  }
  obj->setObjAttempted();
  ObjectData *o = value.getObjectData();
  DataWalker walker(DataWalker::LookupFeature::DetectSerializable);
  DataWalker::DataFeature features = walker.traverseData(o);
  if (features.isCircular() ||
      features.hasCollection() ||
      features.hasSerializableReference()) {
    return nullptr;
  }
  APCHandle* tmp = APCHandle::Create(value, false, true, true);
  tmp->setObjAttempted();
  return tmp;
}
Esempio n. 2
0
APCHandle* APCObject::MakeAPCObject(
    APCHandle* obj, size_t& size, const Variant& value) {
  if (!value.is(KindOfObject) || obj->objAttempted()) {
    return nullptr;
  }
  obj->setObjAttempted();
  ObjectData *o = value.getObjectData();
  if (apcExtension::OptimizeSerialization) {
    return MakeShared(o, size, false, false);
  }
  DataWalker walker(DataWalker::LookupFeature::DetectSerializable);
  DataWalker::DataFeature features = walker.traverseData(o);
  if (features.isCircular() ||
      features.hasCollection() ||
      features.hasSerializableReference()) {
    return nullptr;
  }
  APCHandle* tmp = APCHandle::Create(value, size, false, true, true);
  tmp->setObjAttempted();
  return tmp;
}