Skip to content

Declare ext/standard constants in stubs - part 11 #9728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 20 additions & 0 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
9 changes: 8 additions & 1 deletion ext/standard/basic_functions_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions ext/standard/crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions ext/standard/php_crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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