php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76201 ltrim removes extra char
Submitted: 2018-04-09 10:08 UTC Modified: 2018-04-09 10:20 UTC
From: zewy at hotmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.1.16 OS: CentOs 7
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: zewy at hotmail dot com
New email:
PHP Version: OS:

 

 [2018-04-09 10:08 UTC] zewy at hotmail dot com
Description:
------------
ltrim removes one extra char but only one some chars

Test script:
---------------
<?php

echo ltrim('http://pexample.com','http://');
echo "\r\n";
echo ltrim('http://aexample.com','http://');

Expected result:
----------------
pexample.com
aexample.com

Actual result:
--------------
example.com
aexample.com

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-09 10:20 UTC] pmmaga@php.net
-Status: Open +Status: Not a bug
 [2018-04-09 10:20 UTC] pmmaga@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

The second parameter of ltrim() is a list of characters to be trimmed. In your first example, 'p' is one of the characters that will be trimmed, so this is expected.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC