note 84989 added to function.sha1-file

From: Date: Fri, 08 Aug 2008 15:29:23 +0000
Subject: note 84989 added to function.sha1-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-143312@lists.php.net to get a copy of this message
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); ---- Server IP: 82.177.164.100 Probable Submitter: 193.151.36.17 ---- Manual Page -- http://www.php.net/manual/en/function.sha1-file.php Edit -- https://master.php.net/note/edit/84989 Del: integrated -- https://master.php.net/note/delete/84989/integrated Del: useless -- https://master.php.net/note/delete/84989/useless Del: bad code -- https://master.php.net/note/delete/84989/bad+code Del: spam -- https://master.php.net/note/delete/84989/spam Del: non-english -- https://master.php.net/note/delete/84989/non-english Del: in docs -- https://master.php.net/note/delete/84989/in+docs Del: other reasons-- https://master.php.net/note/delete/84989 Reject -- https://master.php.net/note/reject/84989 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#143312) next »