note 84989 deleted from function.sha1-file by bjori

From: Date: Sat, 09 Aug 2008 17:18:01 +0000
Subject: note 84989 deleted from function.sha1-file by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-143329@lists.php.net to get a copy of this message
Note Submitter: mp at sylaba dot pl Reason: bad code ---- Be aware calculating files with strange chars in its names (like spaces, semicolons...). Unlike in functions like rename(), unlink(), copy()... you shouldn't escape those characters in sha1_file(). Example: $filename="Test file with spaces ; and semicolons.txt"; works: sha1_file($filename); doesn't work: $patt=array("/\;/","/\'/","/\&/","/(\s{1})/e"); $repl=array("\;","\'","\&","chr(92).'\\1'"); $all=preg_replace($patt,$repl,$all); sha1_file($filename);

« previous php.notes (#143329) next »