SharedVariant* SharedVariant::convertObj(CVarRef var) {
  if (!var.is(KindOfObject) || getObjAttempted()) {
    return NULL;
  }
  setObjAttempted();
  PointerSet seen;
  ObjectData *obj = var.getObjectData();
  CArrRef arr = obj->o_toArray();
  if (arr->hasInternalReference(seen, true)) {
    return NULL;
  }
  SharedVariant *tmp = new SharedVariant(var, false, true, true);
  tmp->setObjAttempted();
  return tmp;
}
示例#2
0
SharedVariant* SharedVariant::convertObj(CVarRef var) {
    if (!var.is(KindOfObject) || getObjAttempted()) {
        return NULL;
    }
    setObjAttempted();
    PointerSet seen;
    ObjectData *obj = var.getObjectData();
    if (obj->o_instanceof("Serializable")) {
        // should also check the object itself
        return NULL;
    }
    CArrRef arr = obj->o_toArray();
    if (arr->hasInternalReference(seen, true)) {
        return NULL;
    }
    SharedVariant *tmp = new SharedVariant(var, false, true, true);
    tmp->setObjAttempted();
    return tmp;
}