#44833 [NEW]: inconsistent operator 'or'

From: Date: Fri, 25 Apr 2008 16:42:00 +0000
Subject: #44833 [NEW]: inconsistent operator 'or'
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124518@lists.php.net to get a copy of this message
From:             vmarsik at suse dot cz
Operating system: SuSE Linux
PHP version:      5.2.5
PHP Bug Type:     Unknown/Other Function
Bug description:  inconsistent operator 'or'

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



Thread (3 messages)

« previous php.bugs (#124518) next »