URL:http://www.steki.net/code/download/silverstripe/
patch_against_daily_fix_home_redir.diff
As elijahlofgren noticed applied patch to daily is not fully functional
so i'm creating new one with few adjustments:
simplification of some functions as in silverstripe/sapphire/core/control/Director.php you can see that i replaced few lines with one :)
static function getControllerForURL($url) {
if(isset($_GET['debug_profile'])) Profiler::mark("Director","getControllerForURL");
- $url = str_replace('//','/',$url);
-
- if($url[0] == '/') $url = substr($url,1);
- if($url[strlen($url)-1] == '/') $url = substr($url,0,-1);
+ $url = preg_replace( array( '/\/+/','/^\//', '/\/$/'),array('/','',''),$url);
$urlParts = split('/+', $url);
and so on...
What i would say that i did test speed of str_replace and
preg_replace and get to conclusion that str_replace IS FASTER :)
but in our case i don't think so it is important
because my test case was 200MB Sent mail file (on /dev/shm so no disk usage at all ) and i used 2 cases with next code
------------------------------------------
<?php
$handle = @fopen("/dev/shm/Sent", "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
preg_replace('/mailto:/','something', $buffer);
#str_replace('mailto:','something', $buffer);
}
fclose($handle);
}
?>
------------------------------------------
and situation is that difference is 2-3 seconds with running time of
13+ seconds for both of them (200 MB :) ).