php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66467 Using rtrim function in php 5.4.24
Submitted: 2014-01-11 17:00 UTC Modified: 2014-01-12 00:11 UTC
From: krunaldoshi202 at gmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.4.24 OS: Cent os 6.4
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: krunaldoshi202 at gmail dot com
New email:
PHP Version: OS:

 

 [2014-01-11 17:00 UTC] krunaldoshi202 at gmail dot com
Description:
------------
Its very simple error in rtrim function might be wrong pattern matching

Test script:
---------------
echo rtrim("<a title=\"Music Directed by A.R. Rahman\" href=\"/music-directors/a-r-rahman.html\">A.R. Rahman</a><span>, </span>","<span>, </span>");

Expected result:
----------------
<a title=\"Music Directed by A.R. Rahman\" href=\"/music-directors/a-r-rahman.html\">A.R. Rahman</a>

Actual result:
--------------
<a title="Music Directed by A.R. Rahman" href="/music-directors/a-r-rahman.html">A.R. Rahm

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-11 19:55 UTC] rasmus@php.net
-Status: Open +Status: Spam
 [2014-01-12 00:09 UTC] requinix@php.net
-Summary: Using rtrim function in php 5.4.24 +Summary: Hidden because of SPAM -Status: Spam +Status: Open
 [2014-01-12 00:10 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2014-01-12 00:10 UTC] requinix@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

trim() works on the character level. You told it to rtrim the characters
  < > , / a n p s
so it did.

If you want a portion of the string, like everything up to that <span></span>, then use substr().
http://www.php.net/substr
 [2014-01-12 00:11 UTC] requinix@php.net
-Summary: Hidden because of SPAM +Summary: Using rtrim function in php 5.4.24
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 22:01:28 2024 UTC