Bug #18274 Updated: cannot use if( empty( $object->method() ) )
| From: | derick@php.net | Date: | Thu, 11 Jul 2002 10:48:45 +0000 |
| Subject: | Bug #18274 Updated: cannot use if( empty( $object->method() ) ) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-13844@lists.php.net to get a copy of this message | ||
ID: 18274
Updated by: derick@php.net
Reported By: dennis@moellegaard.dk
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Debian
PHP Version: 4.1.2
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2002-07-11 06:32:22] 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:31:55] 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:25:00] dennis@moellegaard.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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18274&edit=1