[php-src] Issue #20783: Add `\f` as a whitespace character in `trim`

From: Date: Fri, 26 Dec 2025 09:00:03 +0000
Subject: [php-src] Issue #20783: Add `\f` as a whitespace character in `trim`
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251431@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/20783 Author: LamentXU123 ### Description Hi. The trim function will remove whitespaces in the parameters. The default characters are \n\r\t\v\0, [source](https://github.com/php/php-src/blob/85b681a2061cfa5db68d86f8101d331a3af40da0/ext/standard/string.c#L524). I think maybe \f is missing here? In most of the cases in php (such as is_numeric, [source](https://github.com/php/php-src/blob/85b681a2061cfa5db68d86f8101d331a3af40da0/Zend/zend_operators.c#L3643)) 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](https://www.php.net/manual/en/function.trim.php) indicate that trim would "Strip whitespace (or other characters) from the beginning and end of a string", I think \f maybe an unexpected case here. Thanks. ### PHP Version ```plain all version ``` ### Operating System _No response_

« previous php.bugs (#251431) next »