Skip to content

Commit a1e6229

Browse files
committed
Remove random_hex(). *sadface*
1 parent 2c659ed commit a1e6229

File tree

3 files changed

+0
-60
lines changed

3 files changed

+0
-60
lines changed

ext/standard/basic_functions.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,12 +1902,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_random_bytes, 0, 0, 0)
19021902
ZEND_ARG_INFO(0, bytes)
19031903
ZEND_END_ARG_INFO()
19041904

1905-
ZEND_BEGIN_ARG_INFO_EX(arginfo_random_hex, 0, 0, 0)
1906-
ZEND_ARG_INFO(0, bytes)
1907-
ZEND_END_ARG_INFO()
1908-
19091905
ZEND_BEGIN_ARG_INFO_EX(arginfo_random_int, 0, 0, 0)
1910-
ZEND_ARG_INFO(0, min)
19111906
ZEND_ARG_INFO(0, max)
19121907
ZEND_END_ARG_INFO()
19131908
/* }}} */
@@ -2835,7 +2830,6 @@ const zend_function_entry basic_functions[] = { /* {{{ */
28352830
PHP_FE(mt_getrandmax, arginfo_mt_getrandmax)
28362831

28372832
PHP_FE(random_bytes, arginfo_random_bytes)
2838-
PHP_FE(random_hex, arginfo_random_hex)
28392833
PHP_FE(random_int, arginfo_random_int)
28402834

28412835
#if HAVE_GETSERVBYNAME

ext/standard/php_random.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#define PHP_RANDOM_H
2323

2424
PHP_FUNCTION(random_bytes);
25-
PHP_FUNCTION(random_hex);
2625
PHP_FUNCTION(random_int);
2726
#endif
2827

ext/standard/random.c

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,6 @@ union rand_long_buffer {
3535
long number;
3636
};
3737

38-
/*
39-
// Copy/pasted from string.c
40-
static char hexconvtab[] = "0123456789abcdef";
41-
42-
// Copy/pasted from string.c
43-
static void php_bin_to_hex(zend_string *old, const zend_long old_len, zend_string *hex)
44-
{
45-
zend_long i, j;
46-
47-
hex = zend_string_alloc(old_len * 2, 0); // @todo is this right?
48-
49-
for (i = j = 0; i < old_len; i++) {
50-
hex->val[j++] = hexconvtab[old->val[i] >> 4];
51-
hex->val[j++] = hexconvtab[old->val[i] & 15];
52-
}
53-
54-
hex->val[j] = '\0';
55-
}
56-
*/
57-
5838
// Copy/pasted from mcrypt.c
5939
static int php_random_bytes(char *bytes, zend_long size)
6040
{
@@ -127,39 +107,6 @@ PHP_FUNCTION(random_bytes)
127107
}
128108
/* }}} */
129109

130-
/* {{{ proto string random_hex(int bytes)
131-
Return an arbitrary length of pseudo-random bytes as hexadecimal string */
132-
PHP_FUNCTION(random_hex)
133-
{
134-
/*
135-
zend_long size;
136-
zend_string *bytes;
137-
zend_string *hex;
138-
139-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &size) == FAILURE) {
140-
return;
141-
}
142-
143-
if (size <= 0 || size >= INT_MAX) {
144-
php_error_docref(NULL, E_WARNING, "Cannot genrate a random string with a size of less than 1 or greater than %d", INT_MAX);
145-
RETURN_FALSE;
146-
}
147-
148-
if (php_random_bytes(bytes, size) == FAILURE) {
149-
return;
150-
}
151-
152-
int hex_size = size * 2;
153-
154-
php_bin_to_hex(bytes, hex_size, hex);
155-
156-
zend_string_release(bytes);
157-
*/
158-
159-
RETURN_STR("Foo!");
160-
}
161-
/* }}} */
162-
163110
/* {{{ proto int random_int(int maximum)
164111
Return an arbitrary pseudo-random integer */
165112
PHP_FUNCTION(random_int)

0 commit comments

Comments
 (0)