简体   繁体   English

die() 没有阻止代码执行

[英]die() is not stopping code from executing

the problem is in the following:问题如下:

echo 'Hello...';

die('I died...');

echo 'HAHAHA!!!';

on the web browser it is executing the echo after the die().在 web 浏览器上,它在 die() 之后执行 echo。 on the CLI stops on the die() and does not shows the echo as expected.在 CLI 上停止 die() 并且没有按预期显示回声。

My Specs: PHP 7.4 (FPM) web server Nginx (also tried with apache with the same result)我的规格: PHP 7.4 (FPM) web 服务器 Nginx (也与 ZB6EFD0B5B350C9E3D2C19AA801D9442BA9Z 一起尝试了相同的结果)

Also I had a time long a test server on windows and it was exiting the script when exit or die was called, but somehow on the debian test server is not doing that.另外,我在 windows 上的测试服务器有很长一段时间,并且在调用 exit 或 die 时它正在退出脚本,但是在 debian 测试服务器上不知何故没有这样做。

is there something I am missing?有什么我想念的吗? do you guys have any tip?你们有什么建议吗?

Thanks in advance....提前致谢....

Update on 2022-07-27: 2022-07-27 更新:

script:脚本: 在此处输入图像描述

Browser output:浏览器 output: 在此处输入图像描述

CLI output命令行 output 在此处输入图像描述

I've updated the PHP version (same happening):我已经更新了 PHP 版本(同样发生): 在此处输入图像描述

@MarkusZeller yes is disabled the opcache: @MarkusZeller 是的,禁用了 opcache: 在此处输入图像描述

still not working... but somehow on the windows server under php7.4.26 runs the script with the expected die仍然无法正常工作...但不知何故在 php7.4.26 下的 windows 服务器上运行脚本并带有预期的死

The development environment is windows with Debian 11 (WSL2) I have also tried it yesterday on a test machine I have in my home with base Debian 11 installed and it has the same issue.开发环境是 windows 和 Debian 11 (WSL2) 我昨天也在我家的测试机器上尝试过它,基础 Z6FE8B98C53E8D099686936732785D417 安装了相同的问题。 Same thing with the Debian 11 test server at work.与工作中的 Debian 11 测试服务器相同。

@YourCommonSense the script is the same. @YourCommonSense 脚本是一样的。 Here is the nginx path config:这是 nginx 路径配置: 在此处输入图像描述

Solution:解决方案:

The cause of the problem was on the extension php-uopz .问题的原因在于扩展php-uopz After installing every extension individually and testing after every install, the behavior only happens after this extension is activated.在单独安装每个扩展并在每次安装后进行测试后,该行为仅在激活此扩展后才会发生。 Hope this helps in case anyone runs into the same issue.希望这有助于万一有人遇到同样的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM