Home > Backend Development > PHP Tutorial > 一个PHP的Bug?

一个PHP的Bug?

WBOY
Release: 2016-06-23 14:30:45
Original
1281 people have browsed it

测试环境:Windows Server2003 + PHP5.3.5_TS + Apache2.2.19

新建1.php,放在localhot根目录下,文件内容如下:

 

set_error_handler( function() {
             echo '出错了';
        });
set_exception_handler( function() {
             echo '出错了';
        });
error_reporting( E_ALL & ~ E_NOTICE);
// 一段html文本
$html = '

<script>swfobject.embedSWF("/flash/player.swf", "div_D65EEBE0-2955-A608-27A6-CB5713579FC2", "500", "300", "9.0.0","/flash/expressInstall.swf", {file: "/videos/2011/12/26/15/3F5F5136-0200-A646-5B48-C5C4D9ED1C3B.flv"}, {wmode:"opaque",allowfullscreen:"true", allowscriptaccess:"always"}, {id: "player_D65EEBE0-2955-A608-27A6-CB5713579FC2",wmode:"opaque"});</script>';
// 一个去除script脚本块的正则
$reg = '#<script>]*>(((?!(?<![\'""])<\/?script>(?![\'""]))[\s\S])*)</script>#i';
// 正则替换,去除脚本,执行此句的时候杀死了当前的http连接,用Fiddler监控发现此连接的状态码为0(网上没有搜索到状态码为0表示什么意思)
$html=  preg_replace( $reg, '',  $html);
echo  $html;
?>

 用Chrome浏览器,打开http://localhost/1.php,提示:错误 324 (net::ERR_EMPTY_RESPONSE):服务器已断开连接,且未发送任何数据。

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template