什么会导致一个不存在的PHP文件被包含进来呢?

huangapple go评论62阅读模式
英文:

What would cause a non-existent PHP file to be included anyway?

问题

以下是翻译的内容:

我在 PHP 7 上遇到以下错误:

<b>致命错误</b>: 未捕获的 ErrorException:  C:\inetpub\***\templates\left_nav.php 的第 42 行发生了未定义变量:throw_count
堆栈跟踪:
#0 C:\inetpub\***\templates\left_nav.php(42): {closure}(8, '未定义变量...', 'C:\\inetpub\\***...', 42, Array)
#1 C:\inetpub\***\templates\page_header.php(18): require('C:\\inetpub\\***...')
#2 C:\inetpub\***\catalog\product_list.php(232): include('C:\\inetpub\\***...')
#3 C:\inetpub\***\catalog\index.php(13): include('C:\\inetpub\\***...')
#4 {main}
<b>C:\inetpub\***\templates\left_nav.php</b>的第<b>42</b>行抛出&lt;br /&gt;

然而,C:\inetpub\***\templates\left_nav.php 实际上不存在(我将文件重命名为 bad_left_nav.php)。即使它存在,第 42 行也是 $stmt-&gt;execute($params);。即使考虑到由于进入和退出 PHP 代码 (?&gt;raw output&lt;?php) 而导致的行数不一致,脚本中根本没有任何引用 $throw_count 的地方(以前有,我已删除)。


我知道它不是来自其他包含位置:

page_header.php(18): require(APP_DIR . '/templates/left_nav.php');

APP_DIRC:\inetpub\***\catalog\product_list.php 中定义为 define('APP_DIR', dirname(__DIR__));


是什么导致 PHP 包含旧版本的文件? Opcache 已禁用。

英文:

I am getting the following error on PHP 7:

&lt;b&gt;Fatal error&lt;/b&gt;:  Uncaught ErrorException: Undefined variable: throw_count in C:\inetpub\***\templates\left_nav.php:42
Stack trace:
#0 C:\inetpub\***\templates\left_nav.php(42): {closure}(8, &#39;Undefined varia...&#39;, &#39;C:\\inetpub\\***...&#39;, 42, Array)
#1 C:\inetpub\***\templates\page_header.php(18): require(&#39;C:\\inetpub\\***...&#39;)
#2 C:\inetpub\***\catalog\product_list.php(232): include(&#39;C:\\inetpub\\***...&#39;)
#3 C:\inetpub\***\catalog\index.php(13): include(&#39;C:\\inetpub\\***...&#39;)
#4 {main}
  thrown in &lt;b&gt;C:\inetpub\***\templates\left_nav.php&lt;/b&gt; on line &lt;b&gt;42&lt;/b&gt;&lt;br /&gt;

However, C:\inetpub\***\templates\left_nav.php literally does not exist (I renamed the file to bad_left_nav.php). And even if it did exist, line 42 is $stmt-&gt;execute($params);. Even barring the sometimes inconsistent line counts due to entering and exiting PHP code (?&gt;raw output&lt;?php), there aren't even any references to $throw_count anywhere in the script (there used to be, I deleted them).


I know it's not pulling from some other include location:

page_header.php(18): require(APP_DIR . &#39;/templates/left_nav.php&#39;);

APP_DIR is defined as define(&#39;APP_DIR&#39;, dirname(__DIR__)); in C:\inetpub\***\catalog\product_list.php


What would cause PHP to include the old version of this file? Opcache is disabled.

答案1

得分: 2

原来,托管提供商将wincache扩展与此PHP安装捆绑在一起...我必须在每个脚本的开头(或在前端控制器脚本中)包含ini_set('wincache.fcenabled', 0); ini_set('wincache.ucenabled', 0);,直到我能让他们禁用它,或者在我进行开发工作时。

英文:

Turns out, the hosting provider bundled the wincache extension with this PHP installation... I'll have to include ini_set(&#39;wincache.fcenabled&#39;, 0); ini_set(&#39;wincache.ucenabled&#39;, 0); at the start of every script (or in a front controller script) until I can get them to disable it, or while I'm doing the development work.

huangapple
  • 本文由 发表于 2023年6月8日 07:47:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76427751.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定