Concern has been raised over the way failure is indicated by several functions in the core that are often used for security purposes. These functions may fail open, allowing execution to continue, potentially compromising the security of an application. Failure of these functions is only indicating failure through a return value that may be inappropriate cast and used or requiring further function calls to check for failure. It is far too easy for an uninformed programmer to be unaware of the potential for failure and the consequences of neglecting to check for failure, so it is imperative that these functions fail closed, so execution cannot continue if the error is ignored.

The following functions are addressed by this RFC :

random_int()

random_bytes()

An example of a common use of these functions is:

example.php <?php $password = "" ; for ( $i = 0 ; $i < 10 ; $i ++ ) { $password .= chr ( random_int ( 33 , 124 ) ) ; } ?>