From 9aa50a9d7705cb4d605e9562ec0a36ccacbf4cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Wed, 12 Oct 2022 08:28:59 +0200 Subject: [PATCH] Declare ext/stanard constants in stubs - part 11 --- ext/standard/basic_functions.c | 1 + ext/standard/basic_functions.stub.php | 20 ++++++++++++++++++++ ext/standard/basic_functions_arginfo.h | 9 ++++++++- ext/standard/crypt.c | 11 ----------- ext/standard/php_crypt.h | 3 +++ 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index fddd76470b9e1..6f2dc389a7207 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -17,6 +17,7 @@ #include "php.h" #include "php_assert.h" +#include "php_crypt.h" #include "php_streams.h" #include "php_main.h" #include "php_globals.h" diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 86257cbead67f..1a0ac4cdaafd5 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -371,6 +371,26 @@ */ const PHP_ROUND_HALF_ODD = UNKNOWN; +/* crypt.c */ + +/** + * @var int + * @cvalue PHP_MAX_SALT_LEN + */ +const CRYPT_SALT_LENGTH = UNKNOWN; +/** @var int */ +const CRYPT_STD_DES = 1; +/** @var int */ +const CRYPT_EXT_DES = 1; +/** @var int */ +const CRYPT_MD5 = 1; +/** @var int */ +const CRYPT_BLOWFISH = 1; +/** @var int */ +const CRYPT_SHA256 = 1; +/** @var int */ +const CRYPT_SHA512 = 1; + /* dns.c */ #if (defined(PHP_WIN32) || (defined(HAVE_DNS_SEARCH_FUNC) && defined(HAVE_FULL_DNS_FUNCS))) diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 09e2343c139de..1f665fa4251ab 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ae2cadf6fd352eb17e878f377d9b93ee8303943a */ + * Stub hash: 79ae2e13bb3cf12842f6fb2e8c338cbeed8d2a97 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) @@ -3570,6 +3570,13 @@ static void register_basic_functions_symbols(int module_number) REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_STD_DES", 1, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", 1, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_MD5", 1, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", 1, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_SHA256", 1, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_SHA512", 1, CONST_PERSISTENT); #if (defined(PHP_WIN32) || (defined(HAVE_DNS_SEARCH_FUNC) && defined(HAVE_FULL_DNS_FUNCS))) REGISTER_LONG_CONSTANT("DNS_A", PHP_DNS_A, CONST_PERSISTENT); #endif diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index db3a1d33c3f05..a3e0f00c9bcd5 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -45,22 +45,11 @@ #include "php_crypt.h" #include "ext/random/php_random.h" -/* sha512 crypt has the maximal salt length of 123 characters */ -#define PHP_MAX_SALT_LEN 123 - /* Used to check DES salts to ensure that they contain only valid characters */ #define IS_VALID_SALT_CHARACTER(c) (((c) >= '.' && (c) <= '9') || ((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z')) PHP_MINIT_FUNCTION(crypt) /* {{{ */ { - REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_STD_DES", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_MD5", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_SHA256", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_SHA512", 1, CONST_CS | CONST_PERSISTENT); - #if PHP_USE_PHP_CRYPT_R php_init_crypt_r(); #endif diff --git a/ext/standard/php_crypt.h b/ext/standard/php_crypt.h index 080da0a7e7e5b..b7111dfd21b1a 100644 --- a/ext/standard/php_crypt.h +++ b/ext/standard/php_crypt.h @@ -24,4 +24,7 @@ PHP_MINIT_FUNCTION(crypt); PHP_MSHUTDOWN_FUNCTION(crypt); PHP_RINIT_FUNCTION(crypt); +/* sha512 crypt has the maximal salt length of 123 characters */ +#define PHP_MAX_SALT_LEN 123 + #endif