|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25380 strip_tags works different on CLI and Apache
Submitted: 2003-09-03 07:02 UTC Modified: 2003-09-03 11:28 UTC
From: jeroen at terena dot nl Assigned:
Status: Closed Package: CGI/CLI related
PHP Version: 4.3.2 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: jeroen at terena dot nl
New email:
PHP Version: OS:


 [2003-09-03 07:02 UTC] jeroen at terena dot nl
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:
$text = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">
  <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>
$text = strip_tags($text, '<table><tr><th><td><a><ul><li><ol><p><h1><h2><h3><h4><h5><h6>');

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. 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-03 11:28 UTC]
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at

 [2004-03-08 17:17 UTC] mhmad3800 at al-islam dot com
mhmad alhmode
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Sep 17 05:03:37 2021 UTC