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
 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 13:01:31 2024 UTC