Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    JOOMLA e funzione find($paths, $file)

    Salve, ho unu problemino con la funzione find($paths, $file) di joomla.
    Prticamente la funzione find (joomla.filesystem.path) e fatta in questa manera:

    codice:
    public static function find($paths, $file)
    	{
    		settype($paths, 'array'); //force to array
    
    		// start looping through the path set
    
    		foreach ($paths as $path) {
    			// get the path to the file
    			$fullname = $path.'/'.$file;
    			
    			// is the path based on a stream?
    			if (strpos($path, '://') === false) {
    				// not a stream, so do a realpath() to avoid directory
    				// traversal attempts on the local file system.
    				$path = realpath($path); // needed for substr() later
    				$fullname = realpath($fullname);
    			}
    
    			// the substr() check added to make sure that the realpath()
    			// results in a directory registered so that
    			// non-registered directores are not accessible via directory
    			// traversal attempts.
    			if (file_exists($fullname) &&
    			 substr($fullname, 0, strlen($path)) == $path) 
    			 {
    echo ('1 : '.$fullname.'
    ');
    				return $fullname;
    			 }
    		}
    		return false;
    	}
    praticamente dovrebbe far tornare il fullpath di un file se lo trova altrimenti false.

    il problema sta nel fatto che la funzione trova il file ma continua il ciclo senza tenere conto dell istruzione return.

    Qualcuno ha riscontrato lo stesso problema?

    Grazie

  2. #2

  3. #3
    Studiando così il comportamento della funzione è improbabile, azzarderei impossibile, che la funzione continui ad eseguire il ciclo iterativo anche dopo che viene soddisfatto l'and della condizione.

    Se sei sicuro che il ciclo prosegue, io andrei a controllare se da qualche altra parte della pagine vi è un secondo richiamo, o più, della funzione membro.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.