From 31cd3a52fd658b857364f4afd0ca0f6ea2bfffcd Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 21 Jul 2026 11:21:04 +0200 Subject: [PATCH] Fix build with PHP 8.6.0alpha2 . The zend_parse_parameters_none_throw(), zend_parse_parameters_throw(), and ZEND_PARSE_PARAMS_THROW have been removed due to being misleading, since ZPP always throws, unless ZEND_PARSE_PARAMS_QUIET is given. Use the non-throw versions. . Added zend_bin2hex() and zend_bin2hex_str() as helper functions to remove dependencies on /ext/hash in various extensions. And remove dependency on hash extension --- php_scrypt.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/php_scrypt.c b/php_scrypt.c index 86c804d..f058f85 100644 --- a/php_scrypt.c +++ b/php_scrypt.c @@ -36,7 +36,9 @@ #include "zend_config.w32.h" #endif +#if PHP_VERSION_ID < 80600 #include "ext/hash/php_hash.h" +#endif #include "php_scrypt_utils.h" #include "php_scrypt.h" #include "crypto/crypto_scrypt.h" @@ -56,7 +58,9 @@ typedef size_t strsize_t; static const zend_module_dep scrypt_deps[] = { +#if PHP_VERSION_ID < 80600 ZEND_MOD_REQUIRED("hash") +#endif ZEND_MOD_END }; @@ -134,7 +138,7 @@ PHP_FUNCTION(scrypt) /* Get the parameters for this call */ raw_output = 0; - if (zend_parse_parameters_throw( + if (zend_parse_parameters( ZEND_NUM_ARGS(), "ssllll|b", &password, &password_len, &salt, &salt_len, &phpN, &phpR, &phpP, &keyLength, &raw_output @@ -204,7 +208,11 @@ PHP_FUNCTION(scrypt) if (!raw_output) { /* Encode the output in hex */ hex = (char*) safe_emalloc(2, keyLength, 1); +#if PHP_VERSION_ID < 80600 php_hash_bin2hex(hex, buf, keyLength); +#else + zend_bin2hex(hex, buf, keyLength); +#endif efree(buf); hex[keyLength*2] = '\0'; RETVAL_STRINGL(hex, keyLength * 2); @@ -238,7 +246,7 @@ PHP_FUNCTION(scrypt_pickparams) int rc; /* Get the parameters for this call */ - if (zend_parse_parameters_throw( + if (zend_parse_parameters( ZEND_NUM_ARGS(), "ldd", &maxmem, &memfrac, &maxtime ) == FAILURE)