Skip to content

Commit bb75b71

Browse files
committed
drop INI directive. if exceeded, always truncate.
1 parent 2e988e0 commit bb75b71

8 files changed

+2
-33
lines changed

ext/standard/basic_functions.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ PHP_MINFO_FUNCTION(basic) /* {{{ */
568568
BASIC_MINFO_SUBMODULE(mail)
569569
php_info_print_table_end();
570570
BASIC_MINFO_SUBMODULE(assert)
571-
BASIC_MINFO_SUBMODULE(random_class)
572571
}
573572
/* }}} */
574573

ext/standard/php_random_class.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
PHP_MINIT_FUNCTION(random_class);
2121
PHP_MSHUTDOWN_FUNCTION(random_class);
22-
PHP_MINFO_FUNCTION(random_class);
2322

2423
extern PHPAPI zend_class_entry *php_random_class_ce_RandomNumberGenerator;
2524
extern PHPAPI zend_class_entry *php_random_class_ce_Random;

ext/standard/random_class.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,6 @@ const php_random_class_algo php_random_class_algo_secure = {
539539
};
540540
/* secure END */
541541

542-
/* {{{ PHP_INI */
543-
PHP_INI_BEGIN()
544-
STD_PHP_INI_BOOLEAN("random.ignore_generated_size_exceeded", "0", PHP_INI_ALL, OnUpdateBool, random_class_ignore_generated_size_exceeded, php_core_globals, core_globals)
545-
PHP_INI_END()
546-
/* }}} */
547-
548542
/* {{{ */
549543
PHP_METHOD(Random, getAlgos)
550544
{
@@ -653,12 +647,8 @@ PHP_METHOD(Random, nextInt)
653647
ret = php_random_class_next(random_class);
654648
if (random_class->algo) {
655649
if (random_class->algo->generate_size > sizeof(zend_long)) {
656-
if (PG(random_class_ignore_generated_size_exceeded)) {
657-
ret = (zend_ulong) ret;
658-
} else {
659-
zend_throw_exception(NULL, "Generated random number size exceeded", 0);
660-
RETURN_THROWS();
661-
}
650+
/* truncate */
651+
ret = (zend_ulong) ret;
662652
}
663653
/* right shift for future machine compatibility. */
664654
ret = ret >> 1;
@@ -845,8 +835,6 @@ PHP_METHOD(Random, __unserialize)
845835

846836
PHP_MINIT_FUNCTION(random_class)
847837
{
848-
REGISTER_INI_ENTRIES();
849-
850838
zend_hash_init(&php_random_class_algos, 1, NULL, ZVAL_PTR_DTOR, 1);
851839

852840
/* algo: XorShift128+ */
@@ -878,13 +866,6 @@ PHP_MINIT_FUNCTION(random_class)
878866

879867
PHP_MSHUTDOWN_FUNCTION(random_class)
880868
{
881-
UNREGISTER_INI_ENTRIES();
882-
883869
zend_hash_destroy(&php_random_class_algos);
884870
return SUCCESS;
885871
}
886-
887-
PHP_MINFO_FUNCTION(random_class)
888-
{
889-
DISPLAY_INI_ENTRIES();
890-
}

ext/standard/tests/random_class/random_class_clone.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Test Random class clone
3-
--INI--
4-
random.ignore_generated_size_exceeded=1
53
--FILE--
64
<?php
75

ext/standard/tests/random_class/random_class_method_nextInt.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Test Random::nextInt()
3-
--INI--
4-
random.ignore_generated_size_exceeded=1
53
--FILE--
64
<?php
75

ext/standard/tests/random_class/random_class_result_xorshift128plus_32.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ if (PHP_INT_SIZE >= 8) {
66
echo 'skip this test only available on 32bit enviroment.';
77
}
88
?>
9-
--INI--
10-
random.ignore_generated_size_exceeded=1
119
--FILE--
1210
<?php
1311

ext/standard/tests/random_class/random_class_serialize.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Test Random class serialize / unserialize
3-
--INI--
4-
random.ignore_generated_size_exceeded=1
53
--FILE--
64
<?php
75

main/php_globals.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ struct _php_core_globals {
165165
char *syslog_ident;
166166
bool have_called_openlog;
167167
zend_long syslog_filter;
168-
169-
bool random_class_ignore_generated_size_exceeded;
170168
};
171169

172170

0 commit comments

Comments
 (0)