[wp-trac] [WordPress Trac] #36455: Invalidate files in opcode cache after plug-in, theme or core update

WordPress Trac noreply at wordpress.org
Tue Jun 23 09:08:07 UTC 2020


#36455: Invalidate files in opcode cache after plug-in, theme or core update
-------------------------------------------+---------------------------
 Reporter:  nigro.simone                   |       Owner:  mikeschroder
     Type:  enhancement                    |      Status:  assigned
 Priority:  normal                         |   Milestone:  5.5
Component:  Upgrade/Install                |     Version:
 Severity:  normal                         |  Resolution:
 Keywords:  has-patch needs-testing early  |     Focuses:
-------------------------------------------+---------------------------

Comment (by mikeschroder):

 Replying to [comment:102 nextendweb]:
 > Well, if {{{.phtml}}} won't get included, I will be able to rename the
 files in Smart Slider 3. {{{.phtml}}} files are popular in the Magento
 community. I thought there is wider usage in the repos.

 That's great, thank you -- and sorry for the difficulty. Let's see what
 the PHP team says, too.

 > Is it possible that CLI still has a different opcache? <snip>

 Thanks!! I think I figured out what's going on with it from the command
 line, and am working on + testing a patch to change `__DIR__` to
 `realpath( $_SERVER['SCRIPT_FILENAME'] )` now. Here's my current
 understanding:

 PHP compares with `opcache.restrict_api` with `PATH_TRANSLATED`
 [https://github.com/php/php-
 src/blob/master/ext/opcache/zend_accelerator_module.c#L56]. This can be
 different than the included file, which is returned by `__FILE__`.

 However, `$_SERVER['PATH_TRANSLATED']` is
 [https://www.php.net/manual/en/reserved.variables.server.php not always
 available directly].

 So far, `$_SERVER['SCRIPT_FILENAME']` seems to most closely approximate
 this, but `realpath()` is necessary because
 [https://www.php.net/manual/en/reserved.variables.server.php
 `SCRIPT_FILENAME` can be a relative path on the command line].

 I would love to hear if there is a better way to get the `PATH_TRANSLATED`
 that is used.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/36455#comment:103>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list