php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70705 Trim function with a charlist that includes tab '\t' removes t char
Submitted: 2015-10-13 04:12 UTC Modified: 2015-10-13 04:23 UTC
From: joshisa at us dot ibm dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: Irrelevant OS: N/A
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: joshisa at us dot ibm dot com
New email:
PHP Version: OS:

 

 [2015-10-13 04:12 UTC] joshisa at us dot ibm dot com
Description:
------------
Noticed an odd behavior whereby a PHP trim function which includes the "\t" as an optional charlist entry will strip the character "t" from the string if it happens to be the last char.



Test script:
---------------
$returnValue = trim('someurl.net', '\\t');
$returnValue = "someurl.ne"

or 

$returnValue = trim('someurl.net', ' \t\n\r\0\x0B/');
$returnValue = "someurl.ne"

however this is fine ...

$returnValue = trim('someurl.netx', '\t');
$returnValue = "someurl.netx"

Expected result:
----------------
I did not expect that my url's .net domain would "lose" its ending "t" char as a result of performing a trim that included the tab "\t" entry within its char list.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-13 04:23 UTC] requinix@php.net
-Summary: Trim function with a charlist that includes tab "\t" removes t char +Summary: Trim function with a charlist that includes tab '\t' removes t char -Status: Open +Status: Not a bug -Package: *General Issues +Package: Strings related
 [2015-10-13 04:23 UTC] requinix@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

http://php.net/manual/en/language.types.string.php
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 10:01:24 2019 UTC