fix predictability and collision
This commit is contained in:
parent
ee3574a8a3
commit
7b83fddfe0
1 changed files with 4 additions and 0 deletions
|
@ -47,6 +47,10 @@ class Hashtag {
|
||||||
$protect = function( $m ) use ( &$protected_tags ) {
|
$protect = function( $m ) use ( &$protected_tags ) {
|
||||||
$c = \wp_rand( 100000, 999999 );
|
$c = \wp_rand( 100000, 999999 );
|
||||||
$protect = '!#!#PROTECT' . $c . '#!#!';
|
$protect = '!#!#PROTECT' . $c . '#!#!';
|
||||||
|
while ( isset( $protected_tags[ $protect ] ) ) {
|
||||||
|
$c = \wp_rand( 100000, 999999 );
|
||||||
|
$protect = '!#!#PROTECT' . $c . '#!#!';
|
||||||
|
}
|
||||||
$protected_tags[ $protect ] = $m[0];
|
$protected_tags[ $protect ] = $m[0];
|
||||||
return $protect;
|
return $protect;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue