ID: 31302 User updated by: aitrus at tresgeek dot net Reported By: aitrus at tresgeek dot net Status: Wont fix Bug Type: Feature/Change Request PHP Version: 4.3.10 New Comment:
I realize it isn't a function (took a couple time of saying empty( someFn( ) ) to get that through to me)... I haven't, however, looked at the source for empty() so I'm don't know what it's BC is (or what the issue is). The issue I run into is one of (html) input validation. With the behavior of trim() (per our short conversation on bug #31302) it doesn't seem that there is a clean, efficient way of checking for people entering a string of spaces or non-breaking spaces ( ) in the place of legit input. Am I missing something completely? Previous Comments: ------------------------------------------------------------------------ [2004-12-26 11:32:37] [EMAIL PROTECTED] We can't change this due to BC reasons, also, it doesn't fit a particular language construct (empty is NOT a function!) ------------------------------------------------------------------------ [2004-12-26 07:43:20] aitrus at tresgeek dot net Description: ------------ I thought that this used to be the behavior of empty()... It would be nice of empty() returned true when passed a string which only had spaces, tabs, or newline characters in it. Reproduce code: --------------- $foo = ' '; if ( empty( $foo ) ) { echo "foo is empty"; } else { echo "foo is NOT empty"; }//if --- output is: 'foo is NOT empty' Expected result: ---------------- expected output: 'foo is empty' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31302&edit=1