php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #10102 need a better error message when argument to empty() isn't a variable
Submitted: 2001-04-01 19:05 UTC Modified: 2010-12-01 16:04 UTC
From: pulstar at mail dot com Assigned: jani (profile)
Status: Closed Package: *General Issues
PHP Version: 4CVS, 5CVS (2004-04-13) OS: *
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pulstar at mail dot com
New email:
PHP Version: OS:

 

 [2001-04-01 19:05 UTC] pulstar at mail dot com
Parse error: parse error, expecting `')'' 
in c:\site\home\news.php on line 21

Line 21:  if(!empty($news->getField(url)))
Line 22:      echo $news->getField(url);

What is wrong in this line? 
I changed it to:

$thing=$news->getField(url);
if(!empty($thing))
     echo $news->getField(url);

Now, it works fine. Weird...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-02 05:06 UTC] hholzgra@php.net
empty() will only accept variables, 
no expressions

the error message is a little misleading,
do i move this to feature requests:

"have a better error message when argument to 
 empty() isn't a variable"
 [2010-12-01 16:04 UTC] jani@php.net
-Status: Analyzed +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 08:01:35 2024 UTC