From 755439337a15ed6c9d67461bb4cd3d810f891cd9 Mon Sep 17 00:00:00 2001 From: chaituan Date: Wed, 29 Mar 2017 16:31:02 +0800 Subject: [PATCH 1/2] php 7 support --- zhtmltopdf.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/zhtmltopdf.c b/zhtmltopdf.c index 4d5e8f4..5df6da1 100644 --- a/zhtmltopdf.c +++ b/zhtmltopdf.c @@ -211,7 +211,12 @@ PHP_FUNCTION(zhtml2pdf) wkhtmltopdf_destroy_converter(c); if(len > 0) { //RETURN_LONG(len); +#ifdef PHP_MAJOR_VERSION >= 7 + zend_string *ret = zend_string_init(data, len-1, 1); + RETURN_STR(ret); +#else RETURN_STRINGL(data, len, 1); +#endif } else { RETURN_FALSE; } @@ -281,7 +286,12 @@ PHP_FUNCTION(zhtml2img) } else { len = wkhtmltoimage_get_output(c, &data); wkhtmltoimage_destroy_converter(c); - RETURN_STRINGL(data, len, 1); +#ifdef PHP_MAJOR_VERSION >= 7 + zend_string *ret = zend_string_init(data, len-1, 1); + RETURN_STR(ret); +#else + RETURN_STRINGL(data, len, 1); +#endif } } /* }}} */ From 6d48a90c577e76b7ab5d601e8d81962596cd5617 Mon Sep 17 00:00:00 2001 From: chaituan Date: Wed, 29 Mar 2017 17:13:22 +0800 Subject: [PATCH 2/2] php 7 support --- zhtmltopdf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zhtmltopdf.c b/zhtmltopdf.c index 5df6da1..b98877e 100644 --- a/zhtmltopdf.c +++ b/zhtmltopdf.c @@ -211,7 +211,7 @@ PHP_FUNCTION(zhtml2pdf) wkhtmltopdf_destroy_converter(c); if(len > 0) { //RETURN_LONG(len); -#ifdef PHP_MAJOR_VERSION >= 7 +#if PHP_MAJOR_VERSION >= 7 zend_string *ret = zend_string_init(data, len-1, 1); RETURN_STR(ret); #else @@ -286,7 +286,7 @@ PHP_FUNCTION(zhtml2img) } else { len = wkhtmltoimage_get_output(c, &data); wkhtmltoimage_destroy_converter(c); -#ifdef PHP_MAJOR_VERSION >= 7 +#if PHP_MAJOR_VERSION >= 7 zend_string *ret = zend_string_init(data, len-1, 1); RETURN_STR(ret); #else