#25380 [Com]: strip_tags works different on CLI and Apache
| From: | mhmad3800 at al-islam dot com | Date: | Mon, 08 Mar 2004 22:17:19 +0000 |
| Subject: | #25380 [Com]: strip_tags works different on CLI and Apache | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-56123@lists.php.net to get a copy of this message | ||
ID: 25380
Comment by: mhmad3800 at al-islam dot com
Reported By: jeroen at terena dot nl
Status: Closed
Bug Type: CGI related
Operating System: Linux
PHP Version: 4.3.2
New Comment:
mhmad alhmode
Previous Comments:
------------------------------------------------------------------------
[2003-09-03 11:28:51] sniper@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at
http://www.php.net/downloads.php
------------------------------------------------------------------------
[2003-09-03 07:02:59] jeroen at terena dot nl
Description:
------------
Running the same script from the command line and in a browser
generates different results. In the browser a cleaned up HTML string is
returned (as expected) whereas on the CLI I get nothing.. string(0)
Reproduce code:
---------------
<?php
$text = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body bgcolor="#FFFFFF" link="blue" vlink="purple"
lang="EN-US">
<div class="Section1">
<h1>1. Some title</h1>
<p><span lang="EN-GB">Some text </span></p>
</div>
</body>
</html>';
$text = strip_tags($text,
'<table><tr><th><td><a><ul><li><ol><p><h1><h2><h3><h4><h5><h6>');
var_dump($text);
?>
Expected result:
----------------
string(83) "
<h1>1. Some title</h1>
<p>Some text </p>
"
This is printed when I run the code in a browsers. Looks ok to me.
Actual result:
--------------
string(0) ""
this is what PHP CLI prints. Doing an echo of the unstripped $text
works fine, it returns the HTML. After I run the strip_tags over it
though $text becomes empty it seems.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25380&edit=1