php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #50664 Documentation should more clearly list actual behavior
Submitted: 2010-01-05 00:04 UTC Modified: 2010-01-07 11:24 UTC
From: deltascrewyoumail2 at spamplz dot hmx dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
 [2010-01-05 00:04 UTC] deltascrewyoumail2 at spamplz dot hmx dot de
Description:
------------
The Documentation for strip_tags() should mention that the function does not actually look for any html or php Tags but actually just searches for the "<" sign and removes everything from that Position  until it encounters a ">" sign. If there is no ">" in the String the whole string will be cut from the Position of the "<" sign.

Reproduce code:
---------------
---
From manual page: function.strip-tags
---
<?php
$text = "This text has no HTML or PHP Tags and is <50 characters in total length but it wont be listed!";
echo strip_tags($text) . '<br/>';
$text = "This Text <span>Text has HTML Tags</span> and will be listed correctly.";
echo strip_tags($text);
?>

Expected result:
----------------
Both Text Variables to be returned completely with the exception of the <span> and </span> which are html tags. But thats another issue which I doubt will be fixed. So the Added Note in the Documentation should suffice.

Actual result:
--------------
This text has no HTML or PHP Tags and is 
This Text Text has HTML Tags and will be listed correctly.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-05 00:09 UTC] deltascrewyoumail2 at spamplz dot hmx dot de
required field
 [2010-01-07 11:24 UTC] degeberg@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The manual already says that it expects syntactically correct input. Your input is not valid because in HTML the < is a special character that has to be replaced with the HTML entity &lt;.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 02:00:01 2026 UTC