rfc:autoload_include
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:autoload_include [2009/11/10 16:49] – split out the intro into 2 sections lsmith | rfc:autoload_include [2009/11/24 14:32] – moved to proposed state lsmith | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Alternative to include/ | ====== Alternative to include/ | ||
- | * Version: | + | * Version: |
* Date: 2009-11-10 | * Date: 2009-11-10 | ||
* Author: Lukas Smith < | * Author: Lukas Smith < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
This RFC aims to offer an alternative solution to the well known fopen() " | This RFC aims to offer an alternative solution to the well known fopen() " | ||
+ | |||
===== Introduction ===== | ===== Introduction ===== | ||
Line 26: | Line 27: | ||
An alternative approach is to read the include path setting and iterate over all the directories using file_exists(). This is overly expensive, especially with larger include paths. Furthermore it also suffers from the potential race condition, even if the " | An alternative approach is to read the include path setting and iterate over all the directories using file_exists(). This is overly expensive, especially with larger include paths. Furthermore it also suffers from the potential race condition, even if the " | ||
- | |||
===== Proposal ===== | ===== Proposal ===== | ||
In order to solve the above issues this RFC proposes the addition of a new construct/ | In order to solve the above issues this RFC proposes the addition of a new construct/ | ||
+ | The current working title " | ||
===== Optional related aspects ===== | ===== Optional related aspects ===== | ||
- | A potential interesting additional difference could be to return the name of the loaded file in case the file was loaded successfully and the file does not return any value explicitly. This could make it possible to assist in caching the lookup. | + | A potential interesting additional difference could be to return the name of the loaded file in case the file was loaded successfully and the file does not return any value explicitly. This could make it possible to assist in caching the lookup. |
+ | |||
+ | Alternative name proposals: | ||
+ | * include_silent | ||
+ | * contain | ||
+ | * superset | ||
+ | * import | ||
+ | * load | ||
+ | ===== Alternative proposals ===== | ||
+ | |||
+ | ==== Add stream support to include/ | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | <code php> | ||
+ | if ($fp = @fopen($file, | ||
+ | include($fp); | ||
+ | fclose($fp); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | However Stas notes that this would "this would break security distinction between file ops and include ops, when URLs are allowed for open but not include", | ||
+ | ==== Add function to resolve the include path ==== | ||
+ | |||
+ | Either add a " | ||
+ | |||
+ | That being said the current implementation needs some tweaks as Greg points out: | ||
+ | " | ||
===== Changelog ===== | ===== Changelog ===== |
rfc/autoload_include.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1