Bug #18274: cannot use if( empty( $object->method() ) )
| From: | dennis at moellegaard dot dk | Date: | Thu, 11 Jul 2002 10:25:02 +0000 |
| Subject: | Bug #18274: cannot use if( empty( $object->method() ) ) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-13841@lists.php.net to get a copy of this message | ||
From: dennis@moellegaard.dk
Operating system: Debian
PHP version: 4.1.2
PHP Bug Type: Scripting Engine problem
Bug description: cannot use if( empty( $object->method() ) )
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 bug report at http://bugs.php.net/?id=18274&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18274&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18274&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18274&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18274&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18274&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18274&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18274&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18274&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18274&r=globals