#47348 [Opn->Bgs]: (print('') && false) returns int(1)

From: Date: Mon, 09 Feb 2009 14:59:47 +0000
Subject: #47348 [Opn->Bgs]: (print('') && false) returns int(1)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133643@lists.php.net to get a copy of this message
 ID:               47348
 Updated by:       scottmac@php.net
 Reported By:      brunner dot adam at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: debian linux
 PHP Version:      5.2CVS-2009-02-09 (snap)
 New Comment:

print is a language construct and not a function and since the
parenthesis are optional its really:

print '' && false

Where the second expression is considered part of the first.


Previous Comments:
------------------------------------------------------------------------

[2009-02-09 13:58:02] brunner dot adam at gmail dot com

Description:
------------
"print('') && false" returns integer 1, but "false &&
print('')" and
"(int)1 && false" returns false

Reproduce code:
---------------
<?php
var_dump((print('') && false)); // int(1)
?>


Expected result:
----------------
returns bool(false)

Actual result:
--------------
return int(1)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47348&edit=1



Thread (3 messages)

« previous php.bugs (#133643) next »