Ejemplo n.º 1
0
static PHP_FUNCTION(hastur_dump)
{
    zval *var;
    char buf[1024];
    int i, j;

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &var) == FAILURE) {
        RETURN_FALSE;
    }
    
    sprintf(buf, "zval: %p\n  type: %d\n", var, var->type);
    php_output_write(buf, strlen(buf));

    switch (var->type) {
    case IS_STRING:
        sprintf(buf, "  val: %p", var->value.str.val);
        php_output_write(buf, strlen(buf));

        for (i = 0; i < 512; i++) {
            if (i % 16 == 0) {
                php_output_write("\n", 1);
                sprintf(buf, "%08lx: ", (long)var->value.str.val + i - 16);
                php_output_write(buf, strlen(buf));
            }
            sprintf(buf, "%02x ", (unsigned char)var->value.str.val[i-16]);
            php_output_write(buf, strlen(buf));
        }
        php_output_write("\n", 1);
        break;
    default:
        sprintf(buf, "  other type\n");
        php_output_write(buf, strlen(buf));
        break;
    }
}
Ejemplo n.º 2
0
static int php_info_print_html_esc(const char *str, size_t len) /* {{{ */
{
	size_t written;
	zend_string *new_str;

	new_str = php_escape_html_entities((unsigned char *) str, len, 0, ENT_QUOTES, "utf-8");
	written = php_output_write(ZSTR_VAL(new_str), ZSTR_LEN(new_str));
	zend_string_free(new_str);
	return written;
}
Ejemplo n.º 3
0
static int php_info_print_html_esc(const char *str, int len) /* {{{ */
{
	int written;
	zend_string *new_str;
	TSRMLS_FETCH();

	new_str = php_escape_html_entities((unsigned char *) str, len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC);
	written = php_output_write(new_str->val, new_str->len TSRMLS_CC);
	STR_FREE(new_str);
	return written;
}
Ejemplo n.º 4
0
static int php_info_print_html_esc(const char *str, int len) /* {{{ */
{
	size_t new_len;
	int written;
	char *new_str;
	TSRMLS_FETCH();
	
	new_str = php_escape_html_entities((unsigned char *) str, len, &new_len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC);
	written = php_output_write(new_str, new_len TSRMLS_CC);
	efree(new_str);
	return written;
}
Ejemplo n.º 5
0
static int php_info_printf(const char *fmt, ...) /* {{{ */
{
	char *buf;
	size_t len, written;
	va_list argv;

	va_start(argv, fmt);
	len = vspprintf(&buf, 0, fmt, argv);
	va_end(argv);

	written = php_output_write(buf, len);
	efree(buf);
	return written;
}
Ejemplo n.º 6
0
/* {{{ SUCCESS|FAILURE php_output_flush(TSRMLS_D)
 * Flush the most recent output handlers buffer */
PHPAPI int php_output_flush(TSRMLS_D)
{
	php_output_context context;

	if (OG(active) && (OG(active)->flags & PHP_OUTPUT_HANDLER_FLUSHABLE)) {
		php_output_context_init(&context, PHP_OUTPUT_HANDLER_FLUSH TSRMLS_CC);
		php_output_handler_op(OG(active), &context);
		if (context.out.data && context.out.used) {
			zend_stack_del_top(&OG(handlers));
			php_output_write(context.out.data, context.out.used TSRMLS_CC);
			zend_stack_push(&OG(handlers), &OG(active), sizeof(php_output_handler *));
		}
		php_output_context_dtor(&context);
		return SUCCESS;
	}
	return FAILURE;
}
Ejemplo n.º 7
0
static int php_info_print(const char *str) /* {{{ */
{
	TSRMLS_FETCH();
	return php_output_write(str, strlen(str) TSRMLS_CC);
}
Ejemplo n.º 8
0
static int php_info_print(const char *str) /* {{{ */
{
	return php_output_write(str, strlen(str));
}