From: [EMAIL PROTECTED] Operating system: linux PHP version: 4.1.2 PHP Bug Type: Scripting Engine problem Bug description: isset & empty parse error w/ objects
/* See the script below. Passing a value returned from an object function call to isset() and empty() results in a parsing error. strlen() and other functions don't have this problem. The code example below tests empty(). You may substitute isset() as well and get the same parse error. This bug exists on both Apache 1.3.9/PHP 4.1.1 and Apache 1.3.23/PHP 4.1.2 */ //first, declare a simple class with 1 function class Foo { function getStr() { return "foo"; } } //now make an object of that class $foo = new Foo(); /* * now let's test empty() with just the string * this should evaluate false, and result in "not empty" * being printed */ $fooStr = $foo->getStr(); if ( empty($foostr) ) { echo "empty!"; } else { echo "not empty!"; } /* * now test it using the object function call. This is the * functional equivalent of the previous test, and should * result in the same result. However it results in: * "Parse error: parse error, expecting `')'' " * If you comment out this block, this script parses and * executes successfully. */ if ( empty($foo->getStr()) ) { echo "empty!"; } else { echo "not empty!"; } -- Edit bug report at http://bugs.php.net/?id=16046&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16046&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16046&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16046&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16046&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16046&r=support Expected behavior: http://bugs.php.net/fix.php?id=16046&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16046&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16046&r=submittedtwice