|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #22740 add optional parameter to realpath() to use include_path
Submitted: 2003-03-16 20:35 UTC Modified: 2003-03-17 10:11 UTC
From: ben at spamcop dot net Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.3.1 OS:
Private report: No CVE-ID: None
 [2003-03-16 20:35 UTC] ben at spamcop dot net
Many file open functions have an optional parameter that allows for searching the include_path for the given file.

If such an optional parameter would be added to realpath(), all functions that do not offer such a parameter could be passed files from the include_path, too.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-16 20:45 UTC]
But why attach this to the realpath() call?  Do you realize how amazingly expensive realpath()'ing multiple paths would be?  There is a stat syscall for each and every directory in each path plus the final stat for the file itself.  So say you had an include_path with 4 paths in it each one being 5 directories deep, that one realpath() call will cost you 25 stat calls.  Ouch!
 [2003-03-16 21:31 UTC] ben at spamcop dot net
Ok, I wasn't aware of that.

The idea was to have some generic way to find files in the include path for functions that want file system paths as their arguments.
 [2003-03-16 23:16 UTC]
Yup, I understand that and can see merit in that request, but your proposed implementation is bad.  There is no reason to tie this to the realpath() call.  Perhaps something like a find_include_path()
 [2003-03-17 10:11 UTC] ben at spamcop dot net
Yes, my first idea was find_include_path(). I had no idea of the implications of realpath() when I suggested that.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 18:01:30 2024 UTC