php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21253 strip_tags does not produce expected result with less than sign in link-text
Submitted: 2002-12-28 15:22 UTC Modified: 2002-12-28 15:44 UTC
From: pw0kt32001 at sneakemail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.0 OS: Windows XP
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: pw0kt32001 at sneakemail dot com
New email:
PHP Version: OS:

 

 [2002-12-28 15:22 UTC] pw0kt32001 at sneakemail dot com
The text after the "less than" sign is not returned in this example.

print strip_tags("<a href=index.php?mode=item&id=382>Titan 120mm fan, <36dBa, 74.15CFM</a>");

My result is "Titan 120mm fan, " instead of expected "Titan 120mm fan, <36dBa, 74.15CFM"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-28 15:44 UTC] pollita@php.net
<a href=index.php?mode=item&id=382>Titan 120mm fan,
<36dBa, 74.15CFM</a>

The above is an improperly formatted SGML string (and by extension invalid HTML syntax).  When using a "<" as printable text rather than an opening character to a tag the "&lt;" entity should be used.  Without this convention, no parser (be it PHP or a web browser) can be certain if you intend for the "<" to be printed or if it is detoning an opening tag named "36dBa,".

As I'm sure you're about to mention, many browsers WILL attempt to work with this broken syntax and display it when possible, but such shortcuts should not be counted on by any designer.

The behavior of strip_tags which you descibe is the correct and expected behavior.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 01:01:30 2024 UTC