Bug #72449 [Com]: bug of rtrim,ltrim
| From: | youbuwei at yeah dot net | Date: | Sun, 19 Jun 2016 03:39:02 +0000 |
| Subject: | Bug #72449 [Com]: bug of rtrim,ltrim | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201722@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72449&edit=1
ID: 72449
Comment by: youbuwei at yeah dot net
Reported by: youbuwei at yeah dot net
Summary: bug of rtrim,ltrim
Status: Feedback
Type: Bug
Package: Strings related
Operating System: Mac OS X 10.11.5
PHP Version: 7.0.7
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2016-06-19 03:20:11] 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:18:20] 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:00:24] requinix@php.net
Seems to be working just fine. https://3v4l.org/UUcjO
------------------------------------------------------------------------
[2016-06-19 02:53:46] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72449&edit=1