From 3b6cb5cf6f843f1a091b34ce03296abfd02e591f Mon Sep 17 00:00:00 2001 From: Romain Monceau Date: Tue, 26 Jan 2016 18:31:32 +0100 Subject: [PATCH 1/3] Display string value keeping only the first 50 characters --- meminfo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meminfo.c b/meminfo.c index a2824bc..b7e377b 100644 --- a/meminfo.c +++ b/meminfo.c @@ -465,7 +465,11 @@ void meminfo_browse_zval_with_size(php_stream * stream, zval * zv, HashTable *vi php_stream_printf(stream TSRMLS_CC, ",\n"); meminfo_browse_hash_with_size(stream, zv->value.ht, 0, visited_items, first_element); } else { - php_stream_printf(stream TSRMLS_CC, "\n"); + if (Z_TYPE_P(zv) == IS_STRING) { + php_stream_printf(stream TSRMLS_CC, ",\n \"value\" : \"%.50s\"\n", meminfo_escape_for_json(zv->value.str.val)); + } else { + php_stream_printf(stream TSRMLS_CC, "\n"); + } } } From 115efc01d56194e7e4b6ce275ec6e9e5d92ee21a Mon Sep 17 00:00:00 2001 From: Romain Monceau Date: Tue, 26 Jan 2016 18:35:56 +0100 Subject: [PATCH 2/3] Display boolean values on size_info function --- meminfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meminfo.c b/meminfo.c index b7e377b..9b6281b 100644 --- a/meminfo.c +++ b/meminfo.c @@ -467,6 +467,8 @@ void meminfo_browse_zval_with_size(php_stream * stream, zval * zv, HashTable *vi } else { if (Z_TYPE_P(zv) == IS_STRING) { php_stream_printf(stream TSRMLS_CC, ",\n \"value\" : \"%.50s\"\n", meminfo_escape_for_json(zv->value.str.val)); + } else if (Z_TYPE_P(zv) == IS_BOOL) { + php_stream_printf(stream TSRMLS_CC, ",\n \"value\" : \"%s\"\n", zv->value.lval ? "true" : "false"); } else { php_stream_printf(stream TSRMLS_CC, "\n"); } From d4d2d5de405734d7378ced9082a92c20f7039764 Mon Sep 17 00:00:00 2001 From: Romain Monceau Date: Tue, 26 Jan 2016 18:52:06 +0100 Subject: [PATCH 3/3] Display longs and doubles in the size_info --- meminfo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meminfo.c b/meminfo.c index 9b6281b..d143cf8 100644 --- a/meminfo.c +++ b/meminfo.c @@ -469,6 +469,10 @@ void meminfo_browse_zval_with_size(php_stream * stream, zval * zv, HashTable *vi php_stream_printf(stream TSRMLS_CC, ",\n \"value\" : \"%.50s\"\n", meminfo_escape_for_json(zv->value.str.val)); } else if (Z_TYPE_P(zv) == IS_BOOL) { php_stream_printf(stream TSRMLS_CC, ",\n \"value\" : \"%s\"\n", zv->value.lval ? "true" : "false"); + } else if (Z_TYPE_P(zv) == IS_LONG) { + php_stream_printf(stream TSRMLS_CC, ",\n \"value\" : \"%ld\"\n", zv->value.lval); + } else if (Z_TYPE_P(zv) == IS_DOUBLE) { + php_stream_printf(stream TSRMLS_CC, ",\n \"value\" : \"%f\"\n", zv->value.dval); } else { php_stream_printf(stream TSRMLS_CC, "\n"); }