#47381 [NEW]: Some expressions (of classes) don't behave logical

From: Date: Fri, 13 Feb 2009 13:34:46 +0000
Subject: #47381 [NEW]: Some expressions (of classes) don't behave logical
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133801@lists.php.net to get a copy of this message
From:             t dot nickl at exse dot de
Operating system: Ubuntu 8.10
PHP version:      6CVS-2009-02-13 (snap)
PHP Bug Type:     *General Issues
Bug description:  Some expressions (of classes) don't behave logical

Description:
------------
class A
{
        public function getName()
        {
                return("a");
        }
}

//Issue 1:
//This produces "syntax error, unexpected T_OBJECT_OPERATOR":
echo new A()->getName();

//This works:
$_= new A();
echo $_->getName();


//Issue 2:
//This produces "Can't use function return value in write context":
$b= " a";
var_dump(empty(trim($a)));

//This works:
$b= " a";
$_= trim($a);
var_dump(empty($_));



//In php, I must assign an expression to a variable first 
// before being able to use it at some points? Why?


-- 
Edit bug report at http://bugs.php.net/?id=47381&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        http://bugs.php.net/fix.php?id=47381&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        http://bugs.php.net/fix.php?id=47381&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        http://bugs.php.net/fix.php?id=47381&r=trysnapshot60
Fixed in CVS:                        http://bugs.php.net/fix.php?id=47381&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47381&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=47381&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=47381&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=47381&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=47381&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=47381&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=47381&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=47381&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=47381&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=47381&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47381&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47381&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=47381&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=47381&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=47381&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=47381&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=47381&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#133801) next »