php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17517 ucwords() returns false when it should return ''
Submitted: 2002-05-29 20:08 UTC Modified: 2002-06-17 07:38 UTC
From: darren at flyingcolor dot com Assigned:
Status: Closed Package: Strings related
PHP Version: 4.1.2 OS: Linux and NT4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
14 + 16 = ?
Subscribe to this entry?

 
 [2002-05-29 20:08 UTC] darren at flyingcolor dot com
ucwords('') returns a type of boolean but it should return ''. This script demonstrates the problem:

<?php
$s="a bc";
$s2=ucwords($s);
echo gettype($s2).":".$s2;
$s='';
$s2=ucwords($s);
echo gettype($s2).":".$s2;
?>

To get around it I do this after the ucwords() call:
  if(!$s2)$s2='';


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-17 07:38 UTC] hholzgra@php.net
fixed in CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 12 22:01:29 2024 UTC