#44833 [Opn->Bgs]: inconsistent operator 'or'
| From: | colder@php.net | Date: | Fri, 25 Apr 2008 18:54:42 +0000 |
| Subject: | #44833 [Opn->Bgs]: inconsistent operator 'or' | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124521@lists.php.net to get a copy of this message | ||
ID: 44833
Updated by: colder@php.net
Reported By: vmarsik at suse dot cz
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: SuSE Linux
PHP Version: 5.2.5
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
return( null ) is not a value, it can't be used as one in a logical
expression.
Previous Comments:
------------------------------------------------------------------------
[2008-04-25 16:42:00] vmarsik at suse dot cz
Description:
------------
$result = mysql_query($sql) or die( mysql_error() );
- works OK
$result = mysql_query($sql) or return( null );
- Parse error: syntax error, unexpected T_RETURN in xx.php on line 24
$result = mysql_query($sql) or $ret = null;
- works OK
$result = mysql_query($sql) or { $ret = null; return $ret; };
- Parse error: syntax error, unexpected '{' in xx.php on line 24
The second version should behave exactly as the first one.
The fourth probably as well.
Also applies to '||', which behaves exactly as 'or'.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44833&edit=1