/* {{{ proto int tidy_get_html_ver() Get the Detected HTML version for the specified document. */ static PHP_FUNCTION(tidy_get_html_ver) { TIDY_FETCH_OBJECT; RETURN_LONG(tidyDetectedHtmlVersion(obj->ptdoc->doc)); }
ONPHP_METHOD(Joiner, getTablesCount) { zval *tables = ONPHP_READ_PROPERTY(getThis(), "tables"); RETURN_LONG(zend_hash_num_elements(Z_ARRVAL_P(tables))); }
void binary_deserialize(int8_t thrift_typeID, PHPInputTransport& transport, zval* return_value, HashTable* fieldspec) { zval** val_ptr; Z_TYPE_P(return_value) = IS_NULL; // just in case switch (thrift_typeID) { case T_STOP: case T_VOID: RETURN_NULL(); return; case T_STRUCT: { if (zend_hash_find(fieldspec, "class", 6, (void**)&val_ptr) != SUCCESS) { throw_tprotocolexception("no class type in spec", INVALID_DATA); skip_element(T_STRUCT, transport); RETURN_NULL(); } char* structType = Z_STRVAL_PP(val_ptr); createObject(structType, return_value); if (Z_TYPE_P(return_value) == IS_NULL) { // unable to create class entry skip_element(T_STRUCT, transport); RETURN_NULL(); } TSRMLS_FETCH(); zval* spec = zend_read_static_property(zend_get_class_entry(return_value TSRMLS_CC), "_TSPEC", 6, false TSRMLS_CC); if (Z_TYPE_P(spec) != IS_ARRAY) { char errbuf[128]; snprintf(errbuf, 128, "spec for %s is wrong type: %d\n", structType, Z_TYPE_P(spec)); throw_tprotocolexception(errbuf, INVALID_DATA); RETURN_NULL(); } binary_deserialize_spec(return_value, transport, Z_ARRVAL_P(spec)); return; } break; case T_BOOL: { uint8_t c; transport.readBytes(&c, 1); RETURN_BOOL(c != 0); } //case T_I08: // same numeric value as T_BYTE case T_BYTE: { uint8_t c; transport.readBytes(&c, 1); RETURN_LONG(c); } case T_I16: { uint16_t c; transport.readBytes(&c, 2); RETURN_LONG(ntohs(c)); } case T_I32: { uint32_t c; transport.readBytes(&c, 4); RETURN_LONG(ntohl(c)); } case T_U64: case T_I64: { uint64_t c; transport.readBytes(&c, 8); RETURN_LONG(ntohll(c)); } case T_DOUBLE: { union { uint64_t c; double d; } a; transport.readBytes(&(a.c), 8); a.c = ntohll(a.c); RETURN_DOUBLE(a.d); } //case T_UTF7: // aliases T_STRING case T_UTF8: case T_UTF16: case T_STRING: { uint32_t size = transport.readU32(); if (size) { char* strbuf = (char*) emalloc(size + 1); transport.readBytes(strbuf, size); strbuf[size] = '\0'; ZVAL_STRINGL(return_value, strbuf, size, 0); } else { ZVAL_EMPTY_STRING(return_value); } return; } case T_MAP: { // array of key -> value uint8_t types[2]; transport.readBytes(types, 2); uint32_t size = transport.readU32(); array_init(return_value); zend_hash_find(fieldspec, "key", 4, (void**)&val_ptr); HashTable* keyspec = Z_ARRVAL_PP(val_ptr); zend_hash_find(fieldspec, "val", 4, (void**)&val_ptr); HashTable* valspec = Z_ARRVAL_PP(val_ptr); for (uint32_t s = 0; s < size; ++s) { zval *value; MAKE_STD_ZVAL(value); zval* key; MAKE_STD_ZVAL(key); binary_deserialize(types[0], transport, key, keyspec); binary_deserialize(types[1], transport, value, valspec); if (Z_TYPE_P(key) == IS_LONG) { zend_hash_index_update(return_value->value.ht, Z_LVAL_P(key), &value, sizeof(zval *), NULL); } else { if (Z_TYPE_P(key) != IS_STRING) convert_to_string(key); zend_hash_update(return_value->value.ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL); } zval_ptr_dtor(&key); } return; // return_value already populated } case T_LIST: { // array with autogenerated numeric keys int8_t type = transport.readI8(); uint32_t size = transport.readU32(); zend_hash_find(fieldspec, "elem", 5, (void**)&val_ptr); HashTable* elemspec = Z_ARRVAL_PP(val_ptr); array_init(return_value); for (uint32_t s = 0; s < size; ++s) { zval *value; MAKE_STD_ZVAL(value); binary_deserialize(type, transport, value, elemspec); zend_hash_next_index_insert(return_value->value.ht, &value, sizeof(zval *), NULL); } return; } case T_SET: { // array of key -> TRUE uint8_t type; uint32_t size; transport.readBytes(&type, 1); transport.readBytes(&size, 4); size = ntohl(size); zend_hash_find(fieldspec, "elem", 5, (void**)&val_ptr); HashTable* elemspec = Z_ARRVAL_PP(val_ptr); array_init(return_value); for (uint32_t s = 0; s < size; ++s) { zval* key; zval* value; MAKE_STD_ZVAL(key); MAKE_STD_ZVAL(value); ZVAL_TRUE(value); binary_deserialize(type, transport, key, elemspec); if (Z_TYPE_P(key) == IS_LONG) { zend_hash_index_update(return_value->value.ht, Z_LVAL_P(key), &value, sizeof(zval *), NULL); } else { if (Z_TYPE_P(key) != IS_STRING) convert_to_string(key); zend_hash_update(return_value->value.ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL); } zval_ptr_dtor(&key); } return; } }; char errbuf[128]; sprintf(errbuf, "Unknown thrift typeID %d", thrift_typeID); throw_tprotocolexception(errbuf, INVALID_DATA); }
static PHP_METHOD(swoole_ringqueue, count) { swRingQueue *queue = swoole_get_object(getThis()); RETURN_LONG(swRingQueue_count(queue)); }
/* {{{ proto mixed ZMQSocket::getSockOpt() Get a socket option */ PHP_METHOD(zmqsocket, getsockopt) { php_zmq_socket_object *intern; long key; size_t value_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &key) == FAILURE) { return; } intern = PHP_ZMQ_SOCKET_OBJECT; if (!intern->socket) { zend_throw_exception(php_zmq_socket_exception_sc_entry_get (), "The socket has not been initialized yet", PHP_ZMQ_INTERNAL_ERROR TSRMLS_CC); return; } switch (key) { case ZMQ_SNDHWM: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_SNDHWM value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_RCVHWM: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_RCVHWM value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_AFFINITY: { uint64_t value; value_len = sizeof(uint64_t); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_AFFINITY value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_RATE: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_RATE value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_RECOVERY_IVL: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_RECOVERY_IVL value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_SNDBUF: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_SNDBUF value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_RCVBUF: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_RCVBUF value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_LINGER: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_LINGER value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_RECONNECT_IVL: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_RECONNECT_IVL value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_RECONNECT_IVL_MAX: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_RECONNECT_IVL_MAX value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_BACKLOG: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_BACKLOG value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_MAXMSGSIZE: { int64_t value; value_len = sizeof(int64_t); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_MAXMSGSIZE value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_SUBSCRIBE: { zend_throw_exception(php_zmq_socket_exception_sc_entry_get (), "Getting ZMQ::SOCKOPT_SUBSCRIBE is not supported", PHP_ZMQ_INTERNAL_ERROR TSRMLS_CC); return; } break; case ZMQ_UNSUBSCRIBE: { zend_throw_exception(php_zmq_socket_exception_sc_entry_get (), "Getting ZMQ::SOCKOPT_UNSUBSCRIBE is not supported", PHP_ZMQ_INTERNAL_ERROR TSRMLS_CC); return; } break; case ZMQ_TYPE: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_TYPE value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_RCVMORE: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_RCVMORE value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_EVENTS: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_EVENTS value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_SNDTIMEO: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_SNDTIMEO value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_RCVTIMEO: { int value; value_len = sizeof(int); if (zmq_getsockopt(intern->socket->z_socket, (int) key, &value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_RCVTIMEO value: %s", zmq_strerror(errno)); return; } RETURN_LONG(value); } break; case ZMQ_IDENTITY: { unsigned char value[PHP_ZMQ_IDENTITY_LEN]; value_len = PHP_ZMQ_IDENTITY_LEN; if (zmq_getsockopt(intern->socket->z_socket, (int) key, value, &value_len) != 0) { zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), errno TSRMLS_CC, "Failed to get the option ZMQ::SOCKOPT_IDENTITY value: %s", zmq_strerror(errno)); return; } RETURN_STRINGL((char *) value, value_len, 1); } break; default: { zend_throw_exception(php_zmq_socket_exception_sc_entry_get (), "Unknown option key", PHP_ZMQ_INTERNAL_ERROR TSRMLS_CC); return; } } }
/** * Returns cache lifetime, always one second expiring content * * @return int */ PHP_METHOD(Phalcon_Cache_Frontend_None, getLifetime){ RETURN_LONG(1); }
PHP_METHOD(SpotifyAlbumIterator, count) { spotifyalbumiterator_object *p = (spotifyalbumiterator_object*)zend_object_store_get_object(getThis() TSRMLS_CC); RETURN_LONG(p->length); }
PHP_METHOD(ExecutionOptions, __get) { char *name; php5to7_size name_len; cassandra_execution_options *self = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } self = PHP_CASSANDRA_GET_EXECUTION_OPTIONS(getThis()); if (name_len == 11 && strncmp("consistency", name, name_len) == 0) { if (self->consistency == -1) { RETURN_NULL(); } RETURN_LONG(self->consistency); } else if (name_len == 17 && strncmp("serialConsistency", name, name_len) == 0) { if (self->serial_consistency == -1) { RETURN_NULL(); } RETURN_LONG(self->serial_consistency); } else if (name_len == 8 && strncmp("pageSize", name, name_len) == 0) { if (self->page_size == -1) { RETURN_NULL(); } RETURN_LONG(self->page_size); } else if (name_len == 16 && strncmp("pagingStateToken", name, name_len) == 0) { if (!self->paging_state_token) { RETURN_NULL(); } PHP5TO7_RETURN_STRINGL(self->paging_state_token, self->paging_state_token_size); } else if (name_len == 7 && strncmp("timeout", name, name_len) == 0) { if (PHP5TO7_ZVAL_IS_UNDEF(self->timeout)) { RETURN_NULL(); } RETURN_ZVAL(PHP5TO7_ZVAL_MAYBE_P(self->timeout), 1, 0); } else if (name_len == 9 && strncmp("arguments", name, name_len) == 0) { if (PHP5TO7_ZVAL_IS_UNDEF(self->arguments)) { RETURN_NULL(); } RETURN_ZVAL(PHP5TO7_ZVAL_MAYBE_P(self->arguments), 1, 0); } else if (name_len == 11 && strncmp("retryPolicy", name, name_len) == 0) { if (PHP5TO7_ZVAL_IS_UNDEF(self->retry_policy)) { RETURN_NULL(); } RETURN_ZVAL(PHP5TO7_ZVAL_MAYBE_P(self->retry_policy), 1, 0); } else if (name_len == 9 && strncmp("timestamp", name, name_len) == 0) { char *string; if (self->timestamp == INT64_MIN) { RETURN_NULL(); } #ifdef WIN32 spprintf(&string, 0, "%I64d", (long long int) self->timestamp); #else spprintf(&string, 0, "%lld", (long long int) self->timestamp); #endif PHP5TO7_RETVAL_STRING(string); efree(string); } }
IMPLEMENT_FUNCTION(player, getPlayCountAtPos) { RETURN_LONG( g_mainFrame->GetQueueInfo(ARG_POS).GetPlayCount() ); }
/* {{{ php_mktime */ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm) { pval **arguments[7]; struct tm *ta, tmbuf; time_t t, seconds; int i, gmadjust, arg_count = ZEND_NUM_ARGS(); int is_dst = -1, chgsecs = 0; long val; if (arg_count > 7 || zend_get_parameters_array_ex(arg_count, arguments) == FAILURE) { WRONG_PARAM_COUNT; } /* convert supplied arguments to longs */ for (i = 0; i < arg_count; i++) { convert_to_long_ex(arguments[i]); } t = time(NULL); #ifdef HAVE_TZSET tzset(); #endif /* ** Set default time parameters with local time values, ** EVEN when some GMT time parameters are specified! ** This may give strange result, with PHP gmmktime(0, 0, 0), ** which is assumed to return GMT midnight time ** for today (in localtime), so that the result time may be ** AFTER or BEFORE the current time. ** May be we should initialize tn using gmtime(), so that ** default parameters for PHP gmmktime would be the current ** GMT time values... */ ta = php_localtime_r(&t, &tmbuf); /* Let DST be unknown. mktime() should compute the right value ** and behave correctly. Unless the user overrides this. */ ta->tm_isdst = -1; /* ** Now change date values with supplied parameters. */ switch(arg_count) { case 7: /* daylight saving time flag */ #ifdef PHP_WIN32 if (daylight > 0) { ta->tm_isdst = is_dst = Z_LVAL_PP(arguments[6]); } else { ta->tm_isdst = is_dst = 0; } #else ta->tm_isdst = is_dst = Z_LVAL_PP(arguments[6]); #endif /* fall-through */ case 6: /* year */ /* special case: a zero in year, month and day is considered illegal as it would be interpreted as 30.11.1999 otherwise */ if ( ( Z_LVAL_PP(arguments[5])==0) &&(Z_LVAL_PP(arguments[4])==0) &&(Z_LVAL_PP(arguments[3])==0) ) { RETURN_LONG(-1); } /* ** Accept parameter in range 0..1000 interpreted as 1900..2900 ** (if 100 is given, it means year 2000) ** or in range 1001..9999 interpreted as is (this will store ** negative tm_year for years in range 1001..1899) ** This function is then Y2K ready, and accepts a wide range of ** dates including the whole gregorian calendar. ** But it cannot represent ancestral dates prior to year 1001. ** Additionally, input parameters of 0..70 are mapped to 100..170 */ if (Z_LVAL_PP(arguments[5]) < 70) ta->tm_year = Z_LVAL_PP(arguments[5]) + 100; else ta->tm_year = Z_LVAL_PP(arguments[5]) - ((Z_LVAL_PP(arguments[5]) > 1000) ? 1900 : 0); /* fall-through */ case 5: /* day in month (1-based) */ val = (*arguments[4])->value.lval; if (val < 1) { chgsecs += (1-val) * 60*60*24; val = 1; } ta->tm_mday = val; /* fall-through */ case 4: /* month (zero-based) */ val = (*arguments[3])->value.lval - 1; while (val < 0) { val += 12; ta->tm_year--; } ta->tm_mon = val; /* fall-through */ case 3: /* second */ val = (*arguments[2])->value.lval; if (val < 1) { chgsecs += (1-val); val = 1; } ta->tm_sec = val; /* fall-through */ case 2: /* minute */ val = (*arguments[1])->value.lval; if (val < 1) { chgsecs += (1-val) * 60; val = 1; } ta->tm_min = val; /* fall-through */ case 1: /* hour */ val = (*arguments[0])->value.lval; /* We avoid midnight and a couple of hours after midnight here to work around various OS-level bugs in mktime and specifically daylight savings time issues in many mktime implementation. See bugs #27533 and #27719 for more info. */ if (val < 4) { chgsecs += (4-val) * 60*60; val = 4; } ta->tm_hour = val; /* fall-through */ case 0: break; } t = mktime(ta); #ifdef PHP_WIN32 if (t - chgsecs < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Windows does not support negative values for this function"); RETURN_LONG(-1); } #endif seconds = t - chgsecs; /* Here we check to see if the chgsecs fuzz factor we applied caused us to move from dst to non-dst or vice-versa. If so we adjust accordingly to avoid being off by an hour on the dst changeover date. */ if (is_dst == -1) { struct tm t1, t2; t1 = *localtime(&t); t2 = *localtime(&seconds); if (t1.tm_isdst != t2.tm_isdst) { seconds += (t1.tm_isdst == 1) ? 3600 : -3600; ta = localtime(&seconds); } /* If the user didn't specify whether the timestamp passed in was dst or not then we fill it in based on the dst setting at the evaluated timestamp at the current TZ */ is_dst = ta->tm_isdst; } if (gm) { #if HAVE_TM_GMTOFF /* ** mktime(ta) very nicely just filled ta->tm_gmtoff with ** the exactly right value for adjustment if we want GMT. */ gmadjust = ta->tm_gmtoff; #else /* ** If correcting for daylight savings time, we set the adjustment to ** the value of timezone - 3600 seconds. */ #ifdef __CYGWIN__ gmadjust = -(is_dst ? _timezone - 3600 : _timezone); #else gmadjust = -(is_dst ? timezone - 3600 : timezone); #endif #endif seconds += gmadjust; } RETURN_LONG(seconds); }
PHP_METHOD(jz_data, count) { zval *prop = zend_read_property(jz_data_class_entry, getThis(), ZEND_STRL(JZ_DATA_PROPERT_NAME), 1, NULL); RETURN_LONG(zend_hash_num_elements(Z_ARRVAL_P(prop))); }
/* {{{ Cassandra\Timestamp::time */ PHP_METHOD(Timestamp, time) { cassandra_timestamp* timestamp = (cassandra_timestamp*) zend_object_store_get_object(getThis() TSRMLS_CC); RETURN_LONG(timestamp->timestamp / 1000); }
/* {{{ proto int tidy_config_count() Returns the Number of Tidy configuration errors encountered for specified document. */ static PHP_FUNCTION(tidy_config_count) { TIDY_FETCH_OBJECT; RETURN_LONG(tidyConfigErrorCount(obj->ptdoc->doc)); }
/* {{{ proto int tidy_access_count() Returns the Number of Tidy accessibility warnings encountered for specified document. */ static PHP_FUNCTION(tidy_access_count) { TIDY_FETCH_OBJECT; RETURN_LONG(tidyAccessWarningCount(obj->ptdoc->doc)); }
static void binary_deserialize(int8_t thrift_typeID, PHPInputTransport& transport, zval* return_value, HashTable* fieldspec) { ZVAL_NULL(return_value); switch (thrift_typeID) { case T_STOP: case T_VOID: RETURN_NULL(); return; case T_STRUCT: { zval* val_ptr = zend_hash_str_find(fieldspec, "class", sizeof("class")-1); if (val_ptr == nullptr) { throw_tprotocolexception("no class type in spec", INVALID_DATA); skip_element(T_STRUCT, transport); RETURN_NULL(); } char* structType = Z_STRVAL_P(val_ptr); // Create an object in PHP userland based on our spec createObject(structType, return_value); if (Z_TYPE_P(return_value) == IS_NULL) { // unable to create class entry skip_element(T_STRUCT, transport); RETURN_NULL(); } zval* spec = zend_read_static_property(Z_OBJCE_P(return_value), "_TSPEC", sizeof("_TSPEC")-1, false); if (Z_TYPE_P(spec) != IS_ARRAY) { char errbuf[128]; snprintf(errbuf, 128, "spec for %s is wrong type: %d\n", structType, Z_TYPE_P(spec)); throw_tprotocolexception(errbuf, INVALID_DATA); RETURN_NULL(); } binary_deserialize_spec(return_value, transport, Z_ARRVAL_P(spec)); return; } break; case T_BOOL: { uint8_t c; transport.readBytes(&c, 1); RETURN_BOOL(c != 0); } //case T_I08: // same numeric value as T_BYTE case T_BYTE: { uint8_t c; transport.readBytes(&c, 1); RETURN_LONG((int8_t)c); } case T_I16: { uint16_t c; transport.readBytes(&c, 2); RETURN_LONG((int16_t)ntohs(c)); } case T_I32: { uint32_t c; transport.readBytes(&c, 4); RETURN_LONG((int32_t)ntohl(c)); } case T_U64: case T_I64: { uint64_t c; transport.readBytes(&c, 8); RETURN_LONG((int64_t)ntohll(c)); } case T_DOUBLE: { union { uint64_t c; double d; } a; transport.readBytes(&(a.c), 8); a.c = ntohll(a.c); RETURN_DOUBLE(a.d); } //case T_UTF7: // aliases T_STRING case T_UTF8: case T_UTF16: case T_STRING: { uint32_t size = transport.readU32(); if (size) { char strbuf[size+1]; transport.readBytes(strbuf, size); strbuf[size] = '\0'; ZVAL_STRINGL(return_value, strbuf, size); } else { ZVAL_EMPTY_STRING(return_value); } return; } case T_MAP: { // array of key -> value uint8_t types[2]; transport.readBytes(types, 2); uint32_t size = transport.readU32(); array_init(return_value); zval *val_ptr; val_ptr = zend_hash_str_find(fieldspec, "key", sizeof("key")-1); HashTable* keyspec = Z_ARRVAL_P(val_ptr); val_ptr = zend_hash_str_find(fieldspec, "val", sizeof("val")-1); HashTable* valspec = Z_ARRVAL_P(val_ptr); for (uint32_t s = 0; s < size; ++s) { zval key, value; binary_deserialize(types[0], transport, &key, keyspec); binary_deserialize(types[1], transport, &value, valspec); if (Z_TYPE(key) == IS_LONG) { zend_hash_index_update(Z_ARR_P(return_value), Z_LVAL(key), &value); } else { if (Z_TYPE(key) != IS_STRING) convert_to_string(&key); zend_symtable_update(Z_ARR_P(return_value), Z_STR(key), &value); } zval_dtor(&key); } return; // return_value already populated } case T_LIST: { // array with autogenerated numeric keys int8_t type = transport.readI8(); uint32_t size = transport.readU32(); zval *val_ptr = zend_hash_str_find(fieldspec, "elem", sizeof("elem")-1); HashTable* elemspec = Z_ARRVAL_P(val_ptr); array_init(return_value); for (uint32_t s = 0; s < size; ++s) { zval value; binary_deserialize(type, transport, &value, elemspec); zend_hash_next_index_insert(Z_ARR_P(return_value), &value); } return; } case T_SET: { // array of key -> TRUE uint8_t type; uint32_t size; transport.readBytes(&type, 1); transport.readBytes(&size, 4); size = ntohl(size); zval *val_ptr = zend_hash_str_find(fieldspec, "elem", sizeof("elem")-1); HashTable* elemspec = Z_ARRVAL_P(val_ptr); array_init(return_value); for (uint32_t s = 0; s < size; ++s) { zval key, value; ZVAL_TRUE(&value); binary_deserialize(type, transport, &key, elemspec); if (Z_TYPE(key) == IS_LONG) { zend_hash_index_update(Z_ARR_P(return_value), Z_LVAL(key), &value); } else { if (Z_TYPE(key) != IS_STRING) convert_to_string(&key); zend_symtable_update(Z_ARR_P(return_value), Z_STR(key), &value); } zval_dtor(&key); } return; } }; char errbuf[128]; sprintf(errbuf, "Unknown thrift typeID %d", thrift_typeID); throw_tprotocolexception(errbuf, INVALID_DATA); }
IMPLEMENT_FUNCTION(player, getDurationAtPos) { RETURN_LONG( g_mainFrame->GetQueueInfo(ARG_POS).GetPlaytimeMs() ); }
/* {{{ proto int Aerospike::info( string request, string &response [, array host [, array options ]] ) Sends an info command to a cluster node */ PHP_METHOD(Aerospike, info) { as_error err; as_error_init(&err); reset_client_error(getThis()); char* request = NULL; size_t request_len; zval* response_zval = NULL; zval* z_policy = NULL; as_host* host = NULL; char* host_str = NULL; uint16_t port_number; char* response_str = NULL; HashTable* destination_host = NULL; zval* host_zval = NULL; zval* port_zval = NULL; as_policy_info info_policy; as_policy_info* info_policy_p = NULL; AerospikeClient* php_client = NULL; aerospike* as_client = NULL; if (check_object_and_connection(getThis(), &err) != AEROSPIKE_OK) { update_client_error(getThis(), err.code, err.message, err.in_doubt); RETURN_LONG(err.code); } php_client = get_aerospike_from_zobj(Z_OBJ_P(getThis())); as_client = php_client->as_client; host = (as_host *)as_vector_get(as_client->config.hosts, 0); host_str = host->name; port_number = host->port; if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz/|h!z", &request, &request_len, &response_zval, &destination_host, &z_policy) == FAILURE) { update_client_error(getThis(),AEROSPIKE_ERR_PARAM, "Invalid arguments to info", false); RETURN_LONG(AEROSPIKE_ERR_PARAM); } /* Cleanup any thing held by the return parameter */ zval_dtor(response_zval); ZVAL_NULL(response_zval); if (z_policy){ if (zval_to_as_policy_info(z_policy, &info_policy, &info_policy_p, &as_client->config.policies.info) != AEROSPIKE_OK) { update_client_error(getThis(), AEROSPIKE_ERR_PARAM, "Invalid policy.", false); RETURN_LONG(AEROSPIKE_ERR_PARAM); } info_policy_p = &info_policy; } // addr hostname or IP of the node // port /* This should be of the form ['addr'=>'hostname', 'port'=>3000] */ if (destination_host) { host_zval = zend_hash_str_find(destination_host, "addr", strlen("addr")); if (!host_zval) { as_error_update(&err, AEROSPIKE_ERR_PARAM, "Host entry must contain an addr"); goto CLEANUP; } if (Z_TYPE_P(host_zval) != IS_STRING) { as_error_update(&err, AEROSPIKE_ERR_PARAM, "addr entry must be a string"); goto CLEANUP; } host_str = Z_STRVAL_P(host_zval); port_zval = zend_hash_str_find(destination_host, "port", strlen("port")); if (!port_zval) { as_error_update(&err, AEROSPIKE_ERR_PARAM, "Host entry must contain a port"); goto CLEANUP; } if (Z_TYPE_P(port_zval) != IS_LONG) { as_error_update(&err, AEROSPIKE_ERR_PARAM, "port entry must be an integer"); goto CLEANUP; } port_number = (uint16_t)Z_LVAL_P(port_zval); } if (aerospike_info_host(as_client, &err, info_policy_p, host_str, port_number, request, &response_str) != AEROSPIKE_OK) { goto CLEANUP; } /* It is possible that an empty response will be returned, so only setup the return * if we get one back. */ if (response_str) { ZVAL_STRING(response_zval, response_str); } CLEANUP: if (err.code != AEROSPIKE_OK) { update_client_error(getThis(), err.code, err.message, err.in_doubt); } if (response_str) { free(response_str); } RETURN_LONG(err.code); }
PHP_METHOD(swoole_atomic_long, get) { sw_atomic_long_t *atomic = swoole_get_object(getThis()); RETURN_LONG(*atomic); }
/* {{{ Cassandra\Date::seconds() */ PHP_METHOD(Date, seconds) { cassandra_date *self = PHP_CASSANDRA_GET_DATE(getThis()); RETURN_LONG(cass_date_time_to_epoch(self->date, 0)); }
/* {{{ Cassandra\Timeuuid::value() */ PHP_METHOD(Timeuuid, version) { cassandra_uuid* uuid = (cassandra_uuid*) zend_object_store_get_object(getThis() TSRMLS_CC); RETURN_LONG((long) cass_uuid_version(uuid->uuid)); }
PHP_METHOD(SpotifyAlbumIterator, key) { spotifyalbumiterator_object *p = (spotifyalbumiterator_object*)zend_object_store_get_object(getThis() TSRMLS_CC); RETURN_LONG(p->position); }
PHP_METHOD(Test_InternalClasses, testStaticPropertyFetch) { RETURN_LONG(303); }
/** * Returns the exit/trace status (see waitpid and sys/wait.h) caused by the child * ChildEvent::getRPid(). * * @return int * @return false if object has not been initialized */ PHP_METHOD(ChildEvent, getRStatus) { event_object *obj = (event_object *)zend_object_store_get_object(getThis() TSRMLS_CC); RETURN_LONG(((ev_child *)obj->watcher)->rstatus); }
static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{{ */ { zval *user_set, **user_signo, *user_siginfo = NULL; long tv_sec = 0, tv_nsec = 0; sigset_t set; HashPosition pos; int signo; siginfo_t siginfo; struct timespec timeout; if (timedwait) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|zll", &user_set, &user_siginfo, &tv_sec, &tv_nsec) == FAILURE) { return; } } else { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|z", &user_set, &user_siginfo) == FAILURE) { return; } } if (sigemptyset(&set) != 0) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); RETURN_FALSE; } zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(user_set), &pos); while (zend_hash_get_current_data_ex(Z_ARRVAL_P(user_set), (void **)&user_signo, &pos) == SUCCESS) { if (Z_TYPE_PP(user_signo) != IS_LONG) { SEPARATE_ZVAL(user_signo); convert_to_long_ex(user_signo); } signo = Z_LVAL_PP(user_signo); if (sigaddset(&set, signo) != 0) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); RETURN_FALSE; } zend_hash_move_forward_ex(Z_ARRVAL_P(user_set), &pos); } if (timedwait) { timeout.tv_sec = (time_t) tv_sec; timeout.tv_nsec = tv_nsec; signo = sigtimedwait(&set, &siginfo, &timeout); } else { signo = sigwaitinfo(&set, &siginfo); } if (signo == -1 && errno != EAGAIN) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); } /* * sigtimedwait and sigwaitinfo can return 0 on success on some * platforms, e.g. NetBSD */ if (!signo && siginfo.si_signo) { signo = siginfo.si_signo; } if (signo > 0 && user_siginfo) { if (Z_TYPE_P(user_siginfo) != IS_ARRAY) { zval_dtor(user_siginfo); array_init(user_siginfo); } else { zend_hash_clean(Z_ARRVAL_P(user_siginfo)); } add_assoc_long_ex(user_siginfo, "signo", sizeof("signo"), siginfo.si_signo); add_assoc_long_ex(user_siginfo, "errno", sizeof("errno"), siginfo.si_errno); add_assoc_long_ex(user_siginfo, "code", sizeof("code"), siginfo.si_code); switch(signo) { #ifdef SIGCHLD case SIGCHLD: add_assoc_long_ex(user_siginfo, "status", sizeof("status"), siginfo.si_status); # ifdef si_utime add_assoc_double_ex(user_siginfo, "utime", sizeof("utime"), siginfo.si_utime); # endif # ifdef si_stime add_assoc_double_ex(user_siginfo, "stime", sizeof("stime"), siginfo.si_stime); # endif add_assoc_long_ex(user_siginfo, "pid", sizeof("pid"), siginfo.si_pid); add_assoc_long_ex(user_siginfo, "uid", sizeof("uid"), siginfo.si_uid); break; #endif case SIGILL: case SIGFPE: case SIGSEGV: case SIGBUS: add_assoc_double_ex(user_siginfo, "addr", sizeof("addr"), (long)siginfo.si_addr); break; #ifdef SIGPOLL case SIGPOLL: add_assoc_long_ex(user_siginfo, "band", sizeof("band"), siginfo.si_band); # ifdef si_fd add_assoc_long_ex(user_siginfo, "fd", sizeof("fd"), siginfo.si_fd); # endif break; #endif EMPTY_SWITCH_DEFAULT_CASE(); } } RETURN_LONG(signo); }
/** {{{ public CheetahPageCore::first() */ PHP_METHOD(cheetah_page_core, first) { RETURN_LONG(1); }
/** * Check whether a role is allowed to access an action from a resource * * <code> * //Does andres have access to the customers resource to create? * $acl->isAllowed('andres', 'Products', 'create'); * * //Do guests have access to any resource to edit? * $acl->isAllowed('guests', '*', 'edit'); * </code> * * @param string $role * @param string $resource * @param string $access * @return boolean */ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed){ zval *role, *resource, *access, *events_manager; zval *event_name = NULL, *status, *default_access, *roles_names; zval *have_access = NULL, *access_roles, *resource_access = NULL; zval *resource_name = NULL; zval *t0 = NULL; HashTable *ah0, *ah1; HashPosition hp0, hp1; zval **hd; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz", &role, &resource, &access) == FAILURE) { RETURN_MM_NULL(); } phalcon_update_property_zval(this_ptr, SL("_activeRole"), role TSRMLS_CC); phalcon_update_property_zval(this_ptr, SL("_activeResource"), resource TSRMLS_CC); phalcon_update_property_zval(this_ptr, SL("_activeAccess"), access TSRMLS_CC); PHALCON_OBS_VAR(events_manager); phalcon_read_property(&events_manager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); if (Z_TYPE_P(events_manager) == IS_OBJECT) { PHALCON_INIT_VAR(event_name); ZVAL_STRING(event_name, "acl:beforeCheckAccess", 1); PHALCON_INIT_VAR(status); PHALCON_CALL_METHOD_PARAMS_2(status, events_manager, "fire", event_name, this_ptr); if (PHALCON_IS_FALSE(status)) { RETURN_CCTOR(status); } } PHALCON_OBS_VAR(default_access); phalcon_read_property(&default_access, this_ptr, SL("_defaultAccess"), PH_NOISY_CC); /** * Check if the role exists */ PHALCON_OBS_VAR(roles_names); phalcon_read_property(&roles_names, this_ptr, SL("_rolesNames"), PH_NOISY_CC); if (!phalcon_array_isset(roles_names, role)) { RETURN_CCTOR(default_access); } PHALCON_INIT_VAR(have_access); PHALCON_OBS_VAR(t0); phalcon_read_property(&t0, this_ptr, SL("_access"), PH_NOISY_CC); PHALCON_OBS_VAR(access_roles); phalcon_array_fetch(&access_roles, t0, role, PH_NOISY_CC); if (!phalcon_is_iterable(access_roles, &ah0, &hp0, 0, 0 TSRMLS_CC)) { return; } while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_FOREACH_KEY(resource_name, ah0, hp0); PHALCON_GET_FOREACH_VALUE(resource_access); if (PHALCON_IS_EQUAL(resource_name, resource)) { if (phalcon_array_isset(resource_access, access)) { PHALCON_OBS_NVAR(have_access); phalcon_array_fetch(&have_access, resource_access, access, PH_NOISY_CC); break; } PHALCON_OBS_NVAR(have_access); phalcon_array_fetch_string(&have_access, resource_access, SL("*"), PH_NOISY_CC); break; } zend_hash_move_forward_ex(ah0, &hp0); } if (Z_TYPE_P(have_access) == IS_NULL) { if (!phalcon_is_iterable(access_roles, &ah1, &hp1, 0, 0 TSRMLS_CC)) { return; } while (zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) == SUCCESS) { PHALCON_GET_FOREACH_KEY(resource_name, ah1, hp1); PHALCON_GET_FOREACH_VALUE(resource_access); if (phalcon_array_isset_string(resource_access, SS("*"))) { if (phalcon_array_isset(resource_access, access)) { PHALCON_OBS_NVAR(have_access); phalcon_array_fetch(&have_access, resource_access, access, PH_NOISY_CC); break; } PHALCON_OBS_NVAR(have_access); phalcon_array_fetch_string(&have_access, resource_access, SL("*"), PH_NOISY_CC); break; } zend_hash_move_forward_ex(ah1, &hp1); } } phalcon_update_property_zval(this_ptr, SL("_accessGranted"), have_access TSRMLS_CC); if (Z_TYPE_P(events_manager) == IS_OBJECT) { PHALCON_INIT_NVAR(event_name); ZVAL_STRING(event_name, "acl:afterCheckAccess", 1); PHALCON_CALL_METHOD_PARAMS_2_NORETURN(events_manager, "fire", event_name, this_ptr); } if (Z_TYPE_P(have_access) == IS_NULL) { PHALCON_MM_RESTORE(); RETURN_LONG(0); } RETURN_CCTOR(have_access); }
/* {{{ Cassandra\Timestamp::time */ PHP_METHOD(Timestamp, time) { cassandra_timestamp *self = PHP_CASSANDRA_GET_TIMESTAMP(getThis()); RETURN_LONG(self->timestamp / 1000); }
/** * Check whether a role is allowed to access an action from a resource * * <code> * //Does andres have access to the customers resource to create? * $acl->isAllowed('andres', 'Products', 'create'); * * //Do guests have access to any resource to edit? * $acl->isAllowed('guests', '*', 'edit'); * </code> * * @param string $role * @param string $resource * @param string $access * @return boolean */ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed){ zval *role, *resource, *access, *events_manager; zval *event_name = NULL, *status, *default_access, *roles_names; zval *have_access = NULL, *access_list, *access_key = NULL; zval *role_inherits, *inherited_roles = NULL, *inherited_role = NULL; HashTable *ah0, *ah1, *ah2; HashPosition hp0, hp1, hp2; zval **hd; PHALCON_MM_GROW(); phalcon_fetch_params(1, 3, 0, &role, &resource, &access); phalcon_update_property_this(this_ptr, SL("_activeRole"), role TSRMLS_CC); phalcon_update_property_this(this_ptr, SL("_activeResource"), resource TSRMLS_CC); phalcon_update_property_this(this_ptr, SL("_activeAccess"), access TSRMLS_CC); PHALCON_OBS_VAR(events_manager); phalcon_read_property_this(&events_manager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); if (Z_TYPE_P(events_manager) == IS_OBJECT) { PHALCON_INIT_VAR(event_name); ZVAL_STRING(event_name, "acl:beforeCheckAccess", 1); PHALCON_INIT_VAR(status); phalcon_call_method_p2(status, events_manager, "fire", event_name, this_ptr); if (PHALCON_IS_FALSE(status)) { RETURN_CCTOR(status); } } PHALCON_OBS_VAR(default_access); phalcon_read_property_this(&default_access, this_ptr, SL("_defaultAccess"), PH_NOISY_CC); /** * Check if the role exists */ PHALCON_OBS_VAR(roles_names); phalcon_read_property_this(&roles_names, this_ptr, SL("_rolesNames"), PH_NOISY_CC); if (!phalcon_array_isset(roles_names, role)) { RETURN_CCTOR(default_access); } PHALCON_INIT_VAR(have_access); PHALCON_OBS_VAR(access_list); phalcon_read_property_this(&access_list, this_ptr, SL("_access"), PH_NOISY_CC); PHALCON_INIT_VAR(access_key); PHALCON_CONCAT_VSVSV(access_key, role, "!", resource, "!", access); /** * Check if there is a direct combination for role-resource-access */ if (phalcon_array_isset(access_list, access_key)) { PHALCON_OBS_NVAR(have_access); phalcon_array_fetch(&have_access, access_list, access_key, PH_NOISY_CC); } /** * Check in the inherits roles */ if (Z_TYPE_P(have_access) == IS_NULL) { PHALCON_OBS_VAR(role_inherits); phalcon_read_property_this(&role_inherits, this_ptr, SL("_roleInherits"), PH_NOISY_CC); if (phalcon_array_isset(role_inherits, role)) { PHALCON_OBS_VAR(inherited_roles); phalcon_array_fetch(&inherited_roles, role_inherits, role, PH_NOISY_CC); } else { PHALCON_INIT_NVAR(inherited_roles); } if (Z_TYPE_P(inherited_roles) == IS_ARRAY) { phalcon_is_iterable(inherited_roles, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HVALUE(inherited_role); PHALCON_INIT_NVAR(access_key); PHALCON_CONCAT_VSVSV(access_key, inherited_role, "!", resource, "!", access); /** * Check if there is a direct combination in one of the inherited roles */ if (phalcon_array_isset(access_list, access_key)) { PHALCON_OBS_NVAR(have_access); phalcon_array_fetch(&have_access, access_list, access_key, PH_NOISY_CC); break; } zend_hash_move_forward_ex(ah0, &hp0); } } } /** * If access wasn't found yet, try role-resource-* */ if (Z_TYPE_P(have_access) == IS_NULL) { PHALCON_INIT_NVAR(access_key); PHALCON_CONCAT_VSVS(access_key, role, "!", resource, "!*"); /** * In the direct role */ if (phalcon_array_isset(access_list, access_key)) { PHALCON_OBS_NVAR(have_access); phalcon_array_fetch(&have_access, access_list, access_key, PH_NOISY_CC); } else { if (Z_TYPE_P(inherited_roles) == IS_ARRAY) { phalcon_is_iterable(inherited_roles, &ah1, &hp1, 0, 0); while (zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) == SUCCESS) { PHALCON_GET_HVALUE(inherited_role); PHALCON_INIT_NVAR(access_key); PHALCON_CONCAT_VSVS(access_key, inherited_role, "!", resource, "!*"); /** * In the inherited roles */ if (phalcon_array_isset(access_list, access_key)) { PHALCON_OBS_NVAR(have_access); phalcon_array_fetch(&have_access, access_list, access_key, PH_NOISY_CC); break; } zend_hash_move_forward_ex(ah1, &hp1); } } } } /** * If access wasn't found yet, try role-*-* */ if (Z_TYPE_P(have_access) == IS_NULL) { PHALCON_INIT_NVAR(access_key); PHALCON_CONCAT_VS(access_key, role, "!*!*"); /** * Try in the direct role */ if (phalcon_array_isset(access_list, access_key)) { PHALCON_OBS_NVAR(have_access); phalcon_array_fetch(&have_access, access_list, access_key, PH_NOISY_CC); } else { if (Z_TYPE_P(inherited_roles) == IS_ARRAY) { phalcon_is_iterable(inherited_roles, &ah2, &hp2, 0, 0); while (zend_hash_get_current_data_ex(ah2, (void**) &hd, &hp2) == SUCCESS) { PHALCON_GET_HVALUE(inherited_role); PHALCON_INIT_NVAR(access_key); PHALCON_CONCAT_VS(access_key, inherited_role, "!*!*"); if (phalcon_array_isset(access_list, access_key)) { PHALCON_OBS_NVAR(have_access); phalcon_array_fetch(&have_access, access_list, access_key, PH_NOISY_CC); break; } zend_hash_move_forward_ex(ah2, &hp2); } } } } phalcon_update_property_this(this_ptr, SL("_accessGranted"), have_access TSRMLS_CC); if (Z_TYPE_P(events_manager) == IS_OBJECT) { PHALCON_INIT_NVAR(event_name); ZVAL_STRING(event_name, "acl:afterCheckAccess", 1); phalcon_call_method_p3_noret(events_manager, "fire", event_name, this_ptr, have_access); } if (Z_TYPE_P(have_access) == IS_NULL) { PHALCON_MM_RESTORE(); RETURN_LONG(0); } RETURN_CCTOR(have_access); }
/* * public void maxMemory() * * Returns GC heap max memory in bytes. */ static void Dalvik_java_lang_Runtime_maxMemory(const u4* args, JValue* pResult) { unsigned int result = gDvm.heapSizeMax; RETURN_LONG(result); }
/* {{{ proto int tidy_get_status() Get status of specified document. */ static PHP_FUNCTION(tidy_get_status) { TIDY_FETCH_OBJECT; RETURN_LONG(tidyStatus(obj->ptdoc->doc)); }