-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Description
Description
Hi.
The trim function will remove whitespaces in the parameters. The default characters are \n\r\t\v\0, source.
I think maybe \f is missing here? In most of the cases in php (such as is_numeric, source) we recognized \f as a whitespace. Also in libc isspace.c we too include \f as whitespaces:
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2005,2007 Oracle. All rights reserved.
*
* $Id: myisspace.c,v 1.4 2007/05/17 15:14:54 bostic Exp $
*/
/*
* myisspace --
*
* PUBLIC: #ifndef HAVE_ISSPACE
* PUBLIC: int myisspace __P((int));
* PUBLIC: #endif
*/
int
myisspace(c)
int c;
{
return (c == '\t' || c == '\n' ||
c == '\v' || c == '\f' || c == '\r' || c == ' ' ? 1 : 0);
}
Since the document indicate that trim would "Strip whitespace (or other characters) from the beginning and end of a string", I think \f may be an unexpected case here as it is usually treated as whitespaces. Thanks.
PHP Version
all version
Operating System
No response
mvorisek