Req #70507 [Opn->Sus]: Combination of is_file() + include (e.g. "include_if_exists")

From: Date: Sat, 05 Aug 2017 04:46:45 +0000
Subject: Req #70507 [Opn->Sus]: Combination of is_file() + include (e.g. "include_if_exists")
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210508@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70507&edit=1

 ID:                 70507
 Updated by:         stas@php.net
 Reported by:        andreas at dqxtech dot net
 Summary:            Combination of is_file() + include (e.g.
                     "include_if_exists")
-Status:             Open
+Status:             Suspended
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   Linux
 PHP Version:        7.0.0RC2
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for your interest in PHP and for submitting a feature request. Please be aware that due to
the magnitude of change this request requires, it would be necessary to discuss it on PHP Internals
list (internals@lists.php.net) as an RFC. Please read the guide about creating RFCs here:
https://wiki.php.net/rfc/howto
If you haven't had experience with writing RFCs before, it is advised to seek guidance on the
Internals list (http://php.net/mailing-lists.php) and/or solicit help from one of the experienced
developers. 

Please to not consider this comment as a negative view on the merits of your proposal - every
proposal which requires changes of certain magnitude, even the very successful and widely supported
ones, must be done through the RFC process. This helps make the process predictable, transparent and
accessible to all developers.


Previous Comments:
------------------------------------------------------------------------
[2015-09-16 01:45:24] yohgaki@php.net

if (@include($script)) {
should be
if (!@include($script)) {

------------------------------------------------------------------------
[2015-09-16 01:44:28] yohgaki@php.net

> Someone will tell me I shouldn't. I am sure of that :)

Right. Generally speaking, it is advised.
"@" operator is like "goto" for me. Sloppy use of "goto" ruins code,
but decent use of "goto" achieves clean and robust code.

if (@include($script)) {
  // ERROR!!
}

is good use case of "@" IMO.

------------------------------------------------------------------------
[2015-09-15 22:10:02] andreas at dqxtech dot net

> If you guys agree this is the case then fine..

At least requinix above says that not all functions are using the file exists cache.

> I recall measuring a slight difference there. Not a big worry, but relevant enough for the
> "fastest classloader in town" game..

And I imagine filesystem performance can be different depending on the environment.

------------------------------------------------------------------------
[2015-09-15 22:08:15] andreas at dqxtech dot net

> I think opcache is already caching file existence checks, so doing file_exists (or is_file)
> should be very cheap once the file is in cache.

If you guys agree this is the case then fine..
I recall measuring a slight difference there. Not a big worry, but relevant enough for the
"fastest classloader in town" game..

> Can't you just do @include?

Someone will tell me I shouldn't. I am sure of that :)

------------------------------------------------------------------------
[2015-09-15 21:39:13] stas@php.net

Can't you just do @include? 

I think opcache is already caching file existence checks, so doing file_exists (or is_file) should
be very cheap once the file is in cache.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=70507


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


Thread (1 message)

  • stas@php.net
  • Unknown Message
    • stas@php.net
« previous php.bugs (#210508) next »