Le Tue, 10 Nov 2009 21:56:47 +0100, Lukas Kahwe Smith a écrit : > On 10.11.2009, at 21:31, Stanislav Malyshev wrote: > >>> ok .. so your objection to the RFC is solely because it introduces a >>> new language construct? >> >> No, my objection is that it is not necessary to introduce a language >> construct, and the construct introduced is not the right one. If >> frameworks want to find out if file exists or get its name - we should >> give them API to do that. If they want just to silence the errors - >> they already have the construct to do that. > > > They dont want to determine if a file exists. They want to be able to > handle the case of a missing file being included differently than a > syntax error. Since php core does not provide such features, the only > way to do this is using the fopen() hack, iterating over the include > path .. or I guess track errors with @. My proposal actually makes it > possible to do what the frameworks need with less overhead. There is no > way to do what these frameworks need inside userland without the above > mentioned hacks. The fact that almost all frameworks are forced to use > these hacks and quite a significant number of developers use frameworks > (resulting in quite a number of apps end users install also using these > frameworks) implies that we are not talking about an edge case here. > > Now I also made it clear that its not about blindly silencing "errors" > but there is a need to differentiate between different error causes. Of > course having to use @ for such a common use case is also not ideal. Its > just that the error handling we provide internally isnt really able to > handle this scenario well: > > 1) checking before adds overhead and opens issue with potential race > conditions > 2) silencing the error and using track errors adds overhead and > potential issues with custom error handlers > > Anyways, lets see if there are other comments in the coming days. I > think you have made your priorities clear. At least I understand them, > but do not share them. > > regards, > Lukas Kahwe Smith > m...@pooteeweet.org
Hi, I think if PHP throws exception instead of warning/error then this problem will not have existence reason : try { include 'file'; // if we are sure about data sort in get_included_files, just do : $fullFileName = array_pop(get_included_files()); // ... } catch(phpParseIncludeException $e) { // ... } catch(missingIncludeException $e) { // ... } catch(includeException $e) { // ... } regards, Alban Leroux s...@paradoxal.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php