php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72449 bug of rtrim,ltrim
Submitted: 2016-06-19 02:53 UTC Modified: 2016-07-05 01:13 UTC
From: youbuwei at yeah dot net Assigned:
Status: Closed Package: taint (PECL)
PHP Version: 7.0.7 OS: Mac OS X 10.11.5
Private report: No CVE-ID: None
 [2016-06-19 02:53 UTC] youbuwei at yeah dot net
Description:
------------
the result of "rtrim" function and "ltrim" function and "trim" function is same.

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

$str = '---12323123123---';
echo trim($str, '-');
echo "\n";
echo rtrim($str, '-');
echo "\n";
echo ltrim($str, '-');
echo "\n";

Expected result:
----------------
12323123123 ---12323123123 12323123123---

Actual result:
--------------
12323123123 12323123123 12323123123 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-19 03:00 UTC] requinix@php.net
-Status: Open +Status: Feedback -Package: PHP Language Specification +Package: Strings related
 [2016-06-19 03:00 UTC] requinix@php.net
Seems to be working just fine. https://3v4l.org/UUcjO
 [2016-06-19 03:18 UTC] youbuwei at yeah dot net
-Status: Feedback +Status: Open
 [2016-06-19 03:18 UTC] youbuwei at yeah dot net
I know it is fine run on other environment,
I think it must be something wrong at a special environment.

my php configuration is:

./configure --prefix=/usr/local/php7  --with-config-file-path=/etc/php7/ --with-config-file-scan-dir=/etc/php7/conf.d  --enable-fpm --enable-phpdbg  --enable-phpdbg-webhelper  --with-zlib=/usr/local/opt/zlib --with-zlib-dir=/usr/local/opt/zlib --enable-bcmath --with-curl --with-libxml-dir=/usr/local/opt/libxml2  --with-gd --with-xpm-dir=/usr/x11 --with-jpeg-dir=/usr/local/opt/jpeg  --with-png-dir=/usr/local/opt/png    --with-freetype-dir=/usr/local/opt/freetype  --enable-gd-native-ttf    --enable-mbstring  --with-mcrypt=/usr/local/opt/mcrypt  --with-mysqli   --with-pdo-mysql  --enable-mysqlnd   --enable-pcntl    --enable-soap  --enable-sockets   --enable-sysvmsg  --enable-sysvsem  --enable-sysvshm --enable-wddx  --with-xmlrpc   --with-pcre-dir   --with-pear   --with-readline=/usr/local/opt/readline  --with-iconv=/usr/local/opt/libiconv --with-gettext=/usr/local/opt/gettext   --with-icu-dir=/usr/local/opt/icu4c  --enable-intl  --with-openssl  --with-openssl-dir=/usr/local/opt/openssl
 [2016-06-19 03:20 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2016-06-19 03:20 UTC] requinix@php.net
That, or it's something wrong with your code. Or how you're viewing the output.
Run exactly what you posted from the CLI. Or run it in a browser but do a View Source of the page.
 [2016-06-19 03:39 UTC] youbuwei at yeah dot net
my terminal output is:

Ruolongs-MacBook-Pro:test Ruolong$ php -v
PHP 7.0.7 (cli) (built: Jun 18 2016 10:52:35) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.0RC3, Copyright (c) 2002-2015, by Derick Rethans
Ruolongs-MacBook-Pro:test Ruolong$ cat index.php 
<?php
$str = '---12323123123---';
echo trim($str, '-');
echo "\n";
echo rtrim($str, '-');
echo "\n";
echo ltrim($str, '-');
echo "\n";
Ruolongs-MacBook-Pro:test Ruolong$ php -f index.php 
12323123123
12323123123
12323123123
 [2016-06-26 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2016-06-28 16:44 UTC] cmb@php.net
-Status: No Feedback +Status: Re-Opened
 [2016-06-28 16:44 UTC] cmb@php.net
The feedback had been provided, so re-opening.
 [2016-07-02 03:12 UTC] laruence@php.net
do you run any third part extensions?


xdebug, taint?
 [2016-07-05 01:13 UTC] youbuwei at yeah dot net
-Status: Re-Opened +Status: Closed -Package: Strings related +Package: taint
 [2016-07-05 01:13 UTC] youbuwei at yeah dot net
Think you very much!
It's solved when i close the 'taint' extension.

the version of 'taint' that i use is the 2.0.1
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Apr 22 18:01:27 2019 UTC