From 48037cb92f0f40ad5a8980d6d77fe5953b0d7dda Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Sat, 2 Nov 2013 20:47:08 +0100 Subject: [PATCH] Fix fatal error because var_export doesn't handle circular dependency. In logs there were lines such as: PHP Fatal error: Nesting level too deep - recursive dependency? in /home/web/prod/platal/include/security.inc.php on line 108, referer: https://www.polytechnique.org/register More information can be found at: - http://stackoverflow.com/questions/12488661/is-it-possible-to-list-out-all-the-global-variables-in-php - http://php.net/manual/fr/function.var-export.php (in the comments) Signed-off-by: Nicolas Iooss --- include/security.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/security.inc.php b/include/security.inc.php index ae9d008..832432f 100644 --- a/include/security.inc.php +++ b/include/security.inc.php @@ -105,7 +105,12 @@ function send_warning_mail($title, $body = '') $mailer->setFrom("webmaster@" . $globals->mail->domain); $mailer->addTo($globals->core->admin_email); $mailer->setSubject("[Plat/al Security Alert] $title"); - $mailer->setTxtBody($body . "Identifiants de session :\n" . var_export($_SESSION, true) . "\n\n" + // Note: we can't do $session = var_export($_SESSION, true) as var_export + // doesn't handle circular dependency correctly. + ob_start(); + var_dump($_SESSION); + $session = ob_get_clean(); + $mailer->setTxtBody($body . "Identifiants de session :\n" . $session . "\n\n" ."Identifiants de connexion :\n" . var_export($_SERVER, true)); $mailer->send(); } -- 2.1.4