#47348 [Bgs]: (print('') && false) returns int(1)
| From: | brunner dot adam at gmail dot com | Date: | Tue, 10 Feb 2009 21:13:55 +0000 |
| Subject: | #47348 [Bgs]: (print('') && false) returns int(1) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-133689@lists.php.net to get a copy of this message | ||
ID: 47348
User updated by: brunner dot adam at gmail dot com
Reported By: brunner dot adam at gmail dot com
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: debian linux
PHP Version: 5.2CVS-2009-02-09 (snap)
New Comment:
Thanks, and you're right. This behaviour is described in the manual at
include's page. But bit confusing, that -- still if it's optional -- I
put the parenthesis, why would not "use" them?
Previous Comments:
------------------------------------------------------------------------
[2009-02-09 14:59:46] scottmac@php.net
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.
------------------------------------------------------------------------
[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