php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44606 Error in description of second paramter for trim in german documentation
Submitted: 2008-04-02 10:03 UTC Modified: 2008-04-02 15:06 UTC
From: julian dot hartmann at gmail dot com Assigned:
Status: Closed Package: Translation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2008-04-02 10:03 UTC] julian dot hartmann at gmail dot com
Description:
------------
Error in description of second paramter for trim in german documentation.
http://www.php.net/manual/de/function.trim.php

The second parameter (charlist) is explained as being a list of ADDITIONAL characters to remove, but trim() seems to replace its default list with this one instead of extending it.

English documentation does state not whether the second param "adds to" or "replaces" the default.

Reproduce code:
---------------
$foo = " \xa0 bar";
$trimmed = trim($foo, "\xa0");
var_dump($trimmed);

$trimmed = trim($foo, "\xa0\x20");
var_dump($trimmed);


Expected result:
----------------
string(3) "bar"
string(3) "bar"

Actual result:
--------------
string(6) "   bar"
string(3) "bar"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-02 14:41 UTC] danbrown@php.net
My native language isn't German, but I do speak it.  To me, the combination of this:

"Die Funktion entfernt Whitespaces an Anfang und Ende von str  und gibt den String dann zur?ck. Ohne Verwendung des zweiten Parameters entfernt trim()  folgende Zeichen"

And this:

"Optional kann eine Liste weiterer Zeichen angef?gt werden, die an Anfang und Ende der Zeichenkette entfernt werden sollen. Um diese Zeichen anzugeben, wird der charlist  Parameter verwendet. Er enth?lt eine Liste aller zu entfernenden Zeichen. Mit .. k?nnen dar?ber hinaus auch ganze Bereiche von Zeichen angegeben werden."

Explains that the second parameter replaces the default charlist.


In addition, the English documentation does, in fact, state the same.
 [2008-04-02 14:55 UTC] julian dot hartmann at gmail dot com
The german wording states "Optional kann eine Liste weiterer Zeichen angef?gt werden" which translates pretty much to "optionally, a list of additional characters can be attached" ("weiterer" = additional; "angef?gt" = attached).

"Er enth?lt eine Liste aller zu entfernenden Zeichen." could be read as stating it correctly, but then it would still contradict the first sentence.

I would recommend to alter the first sentence to a wording like "Optional kann die Liste der Zeichen angegeben werden, die an
Anfang und Ende der Zeichenkette entfernt werden sollen."
(= "Optionally, the list of characters can be specified which will be removed from the beginning and the end of the string.").
This would at least implicitly state that the default list will be replaced.

This would pretty much resemble the english wording, despite none of them explicitly states that the default list will be replaced by the second parameter.
 [2008-04-02 14:57 UTC] julian dot hartmann at gmail dot com
With "explicit" i am referring to a sentence like "This parameter will replace the default list of characters."
 [2008-04-02 15:06 UTC] danbrown@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Agreed.  Once you place the sentences side-by-side, the updated text is better.

Thanks for your submission!

    ~ Dan
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 06:03:35 2021 UTC