phpinfo est considéré comme une vulnérabilité d'exposition d'informations
je le désactive systématiquement sur mes serveurs
en le désactivant, l'accès a la section Administration > Sécurité plante : erreur 500.
pour contourner le problème, dans system.php j'ai tweaké le code, mais il serait peut etre intéressant de la prévoir nativement.
Code : Tout sélectionner
//extract php info
ob_start();
// On vérifie si la fonction phpinfo est autorisée sur le serveur
if (function_exists('phpinfo')) {
phpinfo();
$phpinfo = array('phpinfo' => array());
if(preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) {
foreach($matches as $match) {
if(strlen($match[1])) {
$phpinfo[$match[1]] = array();
} elseif(isset($match[3])){
$ak=array_keys($phpinfo);
$phpinfo[end($ak)][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
} else {
$ak=array_keys($phpinfo);
$phpinfo[end($ak)][] = $match[2];
}
}
}
} else {
// Si phpinfo est désactivé, on vide le tampon d'affichage proprement et on initialise un tableau vide
ob_get_clean();
$phpinfo = array();
}
