|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54993 Return value fails to be used in empty
Submitted: 2011-06-04 14:53 UTC Modified: 2011-06-04 15:26 UTC
From: welfordmartin at gmail dot com Assigned:
Status: Not a bug Package: Compile Warning
PHP Version: 5.3.6 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: welfordmartin at gmail dot com
New email:
PHP Version: OS:


 [2011-06-04 14:53 UTC] welfordmartin at gmail dot com
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]);

  echo "empty";
  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 

Actual result:
Fatal error: Can't use function return value in write context


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-04 15:26 UTC]
-Status: Open +Status: Bogus
 [2011-06-04 15:26 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at


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 */

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Sep 26 22:01:24 2023 UTC