Execute fonction and white page

Hello everybody,

I have a problem with my function.

I insert a function in my Vardefs.php of the module

function genererChaineAleatoire($longueur = 12)
{
 $caracteres = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
 $longueurMax = strlen($caracteres);
 $chaineAleatoire = '';
 for ($i = 0; $i < $longueur; $i++)
 {
 $chaineAleatoire .= $caracteres[rand(0, $longueurMax - 1)];
 }
 return $chaineAleatoire;
}

The function work like I want but when I execute my page, there are a white page… but normaly the page have to refresh and finish in DetailView.php

Someone can to help me please ?

Thank you :slight_smile:

Cordialy,

Hi

when you have white screens it’s likely a PHP Fatal. When you’re in the middle of writing new code this is typically a syntax error in your PHP.

Your PHP log will tell you what the problem is. It is the log defined in the error_log entry in your php.ini .

Hi @Robin17,
Just write these lines on top of your file and you will see the error on screen, but remember to remove these lines when the error is gone

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);