Shimmed ZVAL_PSTRING* API for PHP 5, fixed return for hash output

This commit is contained in:
Justin Boswell
2021-06-21 12:00:54 -07:00
parent e0123d4653
commit ad550a42a8
2 changed files with 6 additions and 7 deletions
+1 -5
View File
@@ -39,12 +39,8 @@ PHP_FUNCTION(aws_crt_hash_digest) {
length = truncate_to;
}
uint8_t *output = aws_crt_hash_digest(hash, truncate_to);
size_t len = strlen((const char *)output) + 1;
char arr[len]; // Make sure there's enough space
strcpy(arr, (char *) output);
printf(arr);
zval *php_output = NULL;
ZVAL_STRINGL(php_output, (const char *)output, length);
ZVAL_PSTRINGL(php_output, (const char *)output, length);
aws_mem_release(aws_crt_default_allocator(), output);
// copy false, destroy false?
RETURN_ZVAL(php_output, false, false);