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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu May 08 05:01:28 2025 UTC