php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34407 ucwords and Title Case
Submitted: 2005-09-07 13:32 UTC Modified: 2014-07-12 03:25 UTC
From: peebidj at hotmail dot com Assigned: datibbaw
Status: Closed Package: Strings related
PHP Version: 4.4.0 OS: All
Private report: No CVE-ID:
 [2005-09-07 13:32 UTC] peebidj at hotmail dot com
Description:
------------
Non alphanumeric characters are influencing the functionality of strtolower and ucwords. When a character in the example is right after a parenthesis, that character is not seen as the first in the word, and hence is not capitalized. This was reported and dismissed earlier, however, I feel that this is something that needs to be looked at, since common sense tells us that any non-alphanumeric character cannot be capitilized.

Reproduce code:
---------------
$foo = "Krung Thep (Bangkok)";
$bar = ucwords(strtolower($foo));

echo $foo;

Expected result:
----------------
Krung Thep (Bangkok)

Actual result:
--------------
Krung Thep (bangkok)

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-12 03:23 UTC] datibbaw@php.net
-Package: Feature/Change Request +Package: *General Issues
 [2014-07-12 03:23 UTC] datibbaw@php.net
With the fix in place you can now do:

ucwords(strtolower($foo), ' ('));
 [2014-07-12 03:25 UTC] datibbaw@php.net
-Status: Open +Status: Closed -Package: *General Issues +Package: Strings related -Assigned To: +Assigned To: datibbaw
 [2014-07-12 03:25 UTC] datibbaw@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC