英文:
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>行抛出<br />
然而,C:\inetpub\***\templates\left_nav.php
实际上不存在(我将文件重命名为 bad_left_nav.php
)。即使它存在,第 42 行也是 $stmt->execute($params);
。即使考虑到由于进入和退出 PHP 代码 (?>raw output<?php
) 而导致的行数不一致,脚本中根本没有任何引用 $throw_count
的地方(以前有,我已删除)。
我知道它不是来自其他包含位置:
page_header.php(18): require(APP_DIR . '/templates/left_nav.php');
APP_DIR
在 C:\inetpub\***\catalog\product_list.php
中定义为 define('APP_DIR', dirname(__DIR__));
是什么导致 PHP 包含旧版本的文件? Opcache 已禁用。
英文:
I am getting the following error on PHP 7:
<b>Fatal error</b>: 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, 'Undefined varia...', '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}
thrown in <b>C:\inetpub\***\templates\left_nav.php</b> on line <b>42</b><br />
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->execute($params);
. Even barring the sometimes inconsistent line counts due to entering and exiting PHP code (?>raw output<?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 . '/templates/left_nav.php');
APP_DIR
is defined as define('APP_DIR', 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('wincache.fcenabled', 0); ini_set('wincache.ucenabled', 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论