php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31964 strip_tags truncates strings at '<<'
Submitted: 2005-02-14 09:51 UTC Modified: 2005-02-14 10:29 UTC
From: tom at designsolution dot co dot uk Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.10 OS: OS X 10.3.8
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tom at designsolution dot co dot uk
New email:
PHP Version: OS:

 

 [2005-02-14 09:51 UTC] tom at designsolution dot co dot uk
Description:
------------
When running strip_tags on a string containing '<<', the string is truncated at the '<<'.

Reproduce code:
---------------
<?php
$test = "testing << testing testing 1 2 3";
print(strip_tags($test));
?>



Expected result:
----------------
Probably should return the complete string eg:

testing << testing testing 1 2 3

At the worst I would have expected it without the << but certainly containing the rest.

Actual result:
--------------
testing

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-14 10:29 UTC] tony2001@php.net
This behaviour is documented:
"Because strip_tags() does not actually validate the HTML, partial, or broken tags can result in the removal of more text/data than expected."
Your HTML is undoubtfully broken.
See http://php.net/strip_tags
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Dec 02 15:00:01 2025 UTC