Skip to content

Commit c59e94f

Browse files
authored
Declare ext/stanard constants in stubs - part 11 (#9728)
1 parent fc11a8a commit c59e94f

File tree

5 files changed

+32
-12
lines changed

5 files changed

+32
-12
lines changed

ext/standard/basic_functions.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "php.h"
1919
#include "php_assert.h"
20+
#include "php_crypt.h"
2021
#include "php_streams.h"
2122
#include "php_main.h"
2223
#include "php_globals.h"

ext/standard/basic_functions.stub.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,26 @@
371371
*/
372372
const PHP_ROUND_HALF_ODD = UNKNOWN;
373373

374+
/* crypt.c */
375+
376+
/**
377+
* @var int
378+
* @cvalue PHP_MAX_SALT_LEN
379+
*/
380+
const CRYPT_SALT_LENGTH = UNKNOWN;
381+
/** @var int */
382+
const CRYPT_STD_DES = 1;
383+
/** @var int */
384+
const CRYPT_EXT_DES = 1;
385+
/** @var int */
386+
const CRYPT_MD5 = 1;
387+
/** @var int */
388+
const CRYPT_BLOWFISH = 1;
389+
/** @var int */
390+
const CRYPT_SHA256 = 1;
391+
/** @var int */
392+
const CRYPT_SHA512 = 1;
393+
374394
/* dns.c */
375395

376396
#if (defined(PHP_WIN32) || (defined(HAVE_DNS_SEARCH_FUNC) && defined(HAVE_FULL_DNS_FUNCS)))

ext/standard/basic_functions_arginfo.h

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/standard/crypt.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,11 @@
4545
#include "php_crypt.h"
4646
#include "ext/random/php_random.h"
4747

48-
/* sha512 crypt has the maximal salt length of 123 characters */
49-
#define PHP_MAX_SALT_LEN 123
50-
5148
/* Used to check DES salts to ensure that they contain only valid characters */
5249
#define IS_VALID_SALT_CHARACTER(c) (((c) >= '.' && (c) <= '9') || ((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
5350

5451
PHP_MINIT_FUNCTION(crypt) /* {{{ */
5552
{
56-
REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT);
57-
REGISTER_LONG_CONSTANT("CRYPT_STD_DES", 1, CONST_CS | CONST_PERSISTENT);
58-
REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", 1, CONST_CS | CONST_PERSISTENT);
59-
REGISTER_LONG_CONSTANT("CRYPT_MD5", 1, CONST_CS | CONST_PERSISTENT);
60-
REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", 1, CONST_CS | CONST_PERSISTENT);
61-
REGISTER_LONG_CONSTANT("CRYPT_SHA256", 1, CONST_CS | CONST_PERSISTENT);
62-
REGISTER_LONG_CONSTANT("CRYPT_SHA512", 1, CONST_CS | CONST_PERSISTENT);
63-
6453
#if PHP_USE_PHP_CRYPT_R
6554
php_init_crypt_r();
6655
#endif

ext/standard/php_crypt.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ PHP_MINIT_FUNCTION(crypt);
2424
PHP_MSHUTDOWN_FUNCTION(crypt);
2525
PHP_RINIT_FUNCTION(crypt);
2626

27+
/* sha512 crypt has the maximal salt length of 123 characters */
28+
#define PHP_MAX_SALT_LEN 123
29+
2730
#endif

0 commit comments

Comments
 (0)