Welcome Guest, Not a member yet? Register   Sign In
index.php - Defined Constants not Absolute [with fix]
#4

[eluser]Pascal Kriete[/eluser]
Ok, I should apologize, the reply came across too harsh.

A quick search for function_exists('realpath') shows that it's a very commonly used snippet. Of course that doesn't make it right. It's almost always accompanied by something like: "It's broken on my server". If more than one person has that problem, it has to be considered in a framework.

Now to clarify the strpos bit. Here's your quote:
Quote:using strpos(’/’) to determine if it’s an “absolute” path ("./something" is not ABSOLUTE path...)

And the accompanying CI code:
Code:
if (strpos($system_folder, '/') === FALSE)
{
    if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
    {
        $system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
    }
}
else
{
    // Swap directory separators to Unix style for consistency
    $system_folder = str_replace("\\", "/", $system_folder);
}

The $system_folder variable either takes a folder name, or a full system path. My server borks when I give it a relative path - that could be a server issue though. So with that prerequisite in mind, the only reason why the else statement would run (and no realpath checking happens) is when a full system path is given.

Quote:The majority of your posts seems to be more about cutting down people than being helpful.
I replied to your post in a tone that I considered to be in line with the way you presented your case at the time. However, not once did I make this personal and I would appreciate if you didn't either. As for cutting people down, if anyone ever feels mistreated by me, they have every right (and I would encourage them) to speak up and put me in my place. We're all equal on this board.

Quote:I’m trying to improve the framework.
So am I. Your last snippet looks like it will work for me, my concern throughout this was compatibility over the wide range of servers that CI is used on.


Messages In This Thread
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-18-2008, 05:35 PM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-18-2008, 07:16 PM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-18-2008, 09:04 PM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-19-2008, 06:50 AM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-19-2008, 07:15 AM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-19-2008, 09:48 AM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-19-2008, 10:55 AM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-19-2008, 12:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB