Exemplo n.º 1
0
bool f_hphp_recursivedirectoryiterator___construct(CObjRef obj, CStrRef path,
    int64_t flags) {
  SmartObject<RecursiveDirectoryIterator> rsrc =
    NEWOBJ(RecursiveDirectoryIterator)(path, flags);
  obj->o_set("rsrc", rsrc, "SplFileInfo");
  return !rsrc->m_dir.isNull();
}
Exemplo n.º 2
0
void binary_deserialize_spec(CObjRef zthis, PHPInputTransport& transport,
                             CArrRef spec) {
  // SET and LIST have 'elem' => array('type', [optional] 'class')
  // MAP has 'val' => array('type', [optiona] 'class')
  while (true) {
    Variant val;

    int8_t ttype = transport.readI8();
    if (ttype == T_STOP) return;
    int16_t fieldno = transport.readI16();
    if (!(val = spec.rvalAt(fieldno)).isNull()) {
      Array fieldspec = val.toArray();
      // pull the field name
      // zend hash tables use the null at the end in the length... so strlen(hash key) + 1.
      String varname = fieldspec.rvalAt(PHPTransport::s_var).toString();

      // and the type
      int8_t expected_ttype = fieldspec.rvalAt(PHPTransport::s_type).toInt64();

      if (ttypes_are_compatible(ttype, expected_ttype)) {
        Variant rv = binary_deserialize(ttype, transport, fieldspec);
        zthis->o_set(varname, rv, zthis->o_getClassName());
      } else {
        skip_element(ttype, transport);
      }
    } else {
      skip_element(ttype, transport);
    }
  }
}
Exemplo n.º 3
0
Object f_hphp_recursiveiteratoriterator___construct(CObjRef obj, CObjRef iterator, int64_t mode, int64_t flags) {
  if (iterator->instanceof(SystemLib::s_RecursiveDirectoryIteratorClass)) {
    CVarRef rsrc = iterator->o_get("rsrc", true, "SplFileInfo");
    obj->o_set("rsrc", NEWOBJ(RecursiveIteratorIterator)(rsrc, mode, flags),
               "RecursiveIteratorIterator");
    return obj;
  }
  throw NotImplementedException("this type of iterator");
}
Exemplo n.º 4
0
void f_hphp_set_property(CObjRef obj, CStrRef cls, CStrRef prop,
                         CVarRef value) {
  obj->o_set(prop.data(), -1, value);
}
Exemplo n.º 5
0
bool f_hphp_directoryiterator___construct(CObjRef obj, CStrRef path) {
  SmartObject<DirectoryIterator> rsrc = NEWOBJ(DirectoryIterator)(path);
  obj->o_set("rsrc", rsrc, "SplFileInfo");
  return !rsrc->m_dir.isNull();
}
Exemplo n.º 6
0
Object f_hphp_splfileobject___construct(CObjRef obj, CStrRef filename, CStrRef open_mode, bool use_include_path, CVarRef context) {
  Variant f = f_fopen(filename, open_mode, use_include_path,
                      context.isNull() ? null_object : context.toObject());
  obj->o_set("rsrc", NEWOBJ(SplFileObject)(f), "SplFileInfo");
  return obj;
}