Edit report at http://bugs.php.net/bug.php?id=54993&edit=1
ID: 54993 Updated by: dtajchre...@php.net Reported by: welfordmartin at gmail dot com Summary: Return value fails to be used in empty -Status: Open +Status: Bogus Type: Bug Package: Compile Warning Operating System: Windows 7 PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php "Note: empty() only checks variables as anything else will result in a parse error. In other words, the following will not work: empty(trim($name))." $c = cleanData::GET("test"); if(empty($c)) { /* etc */ } else { /* etc */ } [1] http://php.net/empty Previous Comments: ------------------------------------------------------------------------ [2011-06-04 14:53:52] welfordmartin at gmail dot com Description: ------------ I have built an MVC (lightweight MVC) now in this is static class ("cleanData") with method for (POST, GET, URL) and use addSlashes on them, the problem is when i use the return data in the empty function ("Fatal error: Can't use function return value in write context") Test script: --------------- class cleanData{ public static function GET($key){ return addslashes($_GET[$key]); } } if(empty(cleanData::GET("test"))){ echo "empty"; }else{ echo cleanData::GET("test"); } Expected result: ---------------- if loaded with ?test=1 i should see 1 on output, if loaded with ?test=, or without test in url i should see empty Actual result: -------------- Fatal error: Can't use function return value in write context ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54993&edit=1