ID:               20902
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: Win2K Server
 PHP Version:      4.2.3
 New Comment:

Use the __FILE__ constant.


Previous Comments:
------------------------------------------------------------------------

[2002-12-09 06:12:17] [EMAIL PROTECTED]

Finding the name of the currently running script (to save it, for
instance, before branching) requires too much messing around to make it
operating system independent. This sort of complexity should be hidden
from end-user programmers.

An example of the hoops needed to be jumped through is shown below:

function me() {
/* returns the name of the current script, without the querystring
portion.
 * this function is necessary because PHP_SELF and REQUEST_URI and
PATH_INFO
 * return different things depending on a lot of things like your OS,
Web
 * server, and the way PHP is compiled (ie. as a CGI, module, ISAPI,
etc.) */

        if (getenv("REQUEST_URI")) {
                $me = getenv("REQUEST_URI");

        } elseif (getenv("PATH_INFO")) {
                $me = getenv("PATH_INFO");

        } elseif (ini_get('register_globals') && $GLOBALS["PHP_SELF"]) {
                $me = $GLOBALS["PHP_SELF"];

// Supply default case that works when register_globals = Off - RJ 
        } else $me = $_SERVER['SCRIPT_NAME'];

        return strip_querystring($me);
}

I think this can be improved. PHP_SELF is quoted as the standard
solution, but I think you'll find those pushing it are relying on a
particular O/S or server.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=20902&edit=1

Reply via email to