PHP 4.0 Bug #8287 Updated: Parse error around empty() when parameter is a object member function

From: Date: Fri, 15 Dec 2000 23:54:37 +0000
Subject: PHP 4.0 Bug #8287 Updated: Parse error around empty() when parameter is a object member function
Groups: php.dev 
Request: Send a blank email to php-dev+get-41533@lists.php.net to get a copy of this message
ID: 8287 Updated by: hholzgra Reported By: dbellizzi@valinux.com Old-Status: Open Status: Closed Bug Type: Scripting Engine problem Assigned To: Comments: please have a look at the manual page at http://php.net/empty "empty -- Determine whether a variable is set" empty() does only accept variables as argument. not general expressions Previous Comments: --------------------------------------------------------------------------- [2000-12-15 18:39:22] dbellizzi@valinux.com The following script generates a parse error on line 8 (Parse error: parse error, expecting `')'' in /home/dbellizzi/cvs/crm/htdocs/test.php on line 8 <?php class Foo { function blah(){ return "abcd"; } } $foo = new Foo(); if (empty($foo->blah())){ echo("foo->blah is empty"); } ?> However, when changed to this script that assigns the variable before checking it with empty(), it works fine: <?php class Foo { function blah(){ return "blah"; } } $foo = new Foo(); $blah = $foo->blah(); if (empty($blah)){ echo("foo->blah is empty"); } ?> I have duplicated this on a few different machines, but if you need information on my setup, libraries, etc. please email me and I'd be happy to provide more information --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=8287

« previous php.dev (#41533) next »