Problème : return true de méthode privée
Salut à tous !
Petit problème avec un retour de méthode privée. Je vous montre le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| const recovery = 'filename.ini';
/*...*/
private function searchCurrentInstallation($path)
{
$tab_file = scandir($path,0); //open the path and return all file and directory in it
for($i=2;$i<count($tab_file);$i++) //start at 2 because there's the object .(full return) and ..(return)
{
if(is_dir($path."/".$tab_file[$i])) //if the current object is a directory
{
$this->searchCurrentInstallation($path."/".$tab_file[$i]); //recall the function
}elseif($tab_file[$i] == self::recovery) //if the file is the recovery
return TRUE; //return true
}
return FALSE; // if no recovery found return false
} |
Cette fonction marche, lors du débugging j'arrive à die("found") lors du test avec mon self::recovery.
Cependant, lorsque le test s'avère positif, aucun retour n'est effectué.
Ps: le but de cette fonction est de parcourir tout le dossier $path (fichier et sous dossier) et de trouver un éventuel 'filename.ini'.
Auriez-vous une idée ?
Merci, bisous :D