From 0bd0337ef36f84bc9ed0dff0f3d7a855df373711 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 25 Sep 2024 15:13:44 +0200 Subject: fix build with PHP 8.4 using patch from https://github.com/bukka/php-crypto/pull/42 --- 0001-fix-for-PHP-8.4.patch | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 0001-fix-for-PHP-8.4.patch (limited to '0001-fix-for-PHP-8.4.patch') diff --git a/0001-fix-for-PHP-8.4.patch b/0001-fix-for-PHP-8.4.patch new file mode 100644 index 0000000..89eb499 --- /dev/null +++ b/0001-fix-for-PHP-8.4.patch @@ -0,0 +1,64 @@ +From 6137150915431a59edb993a008eb3b21fc2d02e0 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 25 Sep 2024 15:06:03 +0200 +Subject: [PATCH] fix for PHP 8.4 + +--- + crypto_cipher.c | 12 ++++++++++++ + crypto_hash.c | 4 ++++ + 2 files changed, 16 insertions(+) + +diff --git a/crypto_cipher.c b/crypto_cipher.c +index a0465c1..fb3e410 100644 +--- a/crypto_cipher.c ++++ b/crypto_cipher.c +@@ -497,7 +497,11 @@ PHP_MINIT_FUNCTION(crypto_cipher) + static inline void php_crypto_cipher_set_algorithm_name(zval *object, + char *algorithm, phpc_str_size_t algorithm_len TSRMLS_DC) + { ++#if PHP_VERSION_ID < 80400 + php_strtoupper(algorithm, algorithm_len); ++#else ++ zend_str_toupper(algorithm, algorithm_len); ++#endif + zend_update_property_stringl(php_crypto_cipher_ce, PHPC_OBJ_FOR_PROP(object), + "algorithm", sizeof("algorithm")-1, algorithm, algorithm_len TSRMLS_CC); + } +@@ -513,10 +517,18 @@ PHP_CRYPTO_API const EVP_CIPHER *php_crypto_get_cipher_algorithm( + return NULL; + } + ++#if PHP_VERSION_ID < 80400 + php_strtoupper(algorithm, algorithm_len); ++#else ++ zend_str_toupper(algorithm, algorithm_len); ++#endif + cipher = EVP_get_cipherbyname(algorithm); + if (!cipher) { ++#if PHP_VERSION_ID < 80400 + php_strtolower(algorithm, algorithm_len); ++#else ++ zend_str_tolower(algorithm, algorithm_len); ++#endif + cipher = EVP_get_cipherbyname(algorithm); + } + return cipher; +diff --git a/crypto_hash.c b/crypto_hash.c +index 8015aa4..9c4f182 100644 +--- a/crypto_hash.c ++++ b/crypto_hash.c +@@ -319,7 +319,11 @@ PHP_MINIT_FUNCTION(crypto_hash) + static inline void php_crypto_hash_set_algorithm_name(zval *object, + char *algorithm, phpc_str_size_t algorithm_len TSRMLS_DC) + { ++#if PHP_VERSION_ID < 80400 + php_strtoupper(algorithm, algorithm_len); ++#else ++ zend_str_toupper(algorithm, algorithm_len); ++#endif + zend_update_property_stringl(php_crypto_hash_ce, PHPC_OBJ_FOR_PROP(object), + "algorithm", sizeof("algorithm")-1, algorithm, algorithm_len TSRMLS_CC); + } +-- +2.46.1 + -- cgit