php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18274 cannot use if( empty( $object->method() ) )
Submitted: 2002-07-11 06:25 UTC Modified: 2002-07-11 06:48 UTC
From: dennis at moellegaard dot dk Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.1.2 OS: Debian
Private report: No CVE-ID: None
 [2002-07-11 06:25 UTC] dennis at moellegaard dot dk
The following source returns "Parse error: parse error, unexpected '(', expecting ',' or ')' in [...]/bug.php on line 24".

<?php

   class MyClass
   {
      function myFunction($arg)
      {
         return $arg;
      }
   }

   $c = new MyClass;

   // works

   $v = $c->myFunction('foo');

   if( empty( $v ) )
      print "test-1: empty";
   else
      print "test-1: not empty";

   // don't work

   if( empty( $c->myFunction('foo') ) ) // this is the problem
      print "test-2: empty";
   else
      print "test-2: not empty";
?>

empty() can be replaced with same result with isset(). The

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-11 06:31 UTC] sander@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2002-07-11 06:32 UTC] sander@php.net
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

Oops :) Wrong text :)
 [2002-07-11 06:48 UTC] derick@php.net
Please read http://www.php.net/manual/en/function.empty.php too, which says:

 Note that this is meaningless when used on anything which isn't a variable; i.e. empty (addslashes ($name)) has no meaning since it would be checking whether something which isn't a variable is a variable with a FALSE value.

Derick
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 07:00:01 2026 UTC