From:             michaeldnelson dot mdn at gmail dot com
Operating system: freebsd
PHP version:      5.2.10
PHP Bug Type:     Scripting Engine problem
Bug description:  order of operations is not valid for assignment in all cases

Description:
------------
It appears = has a higher precedence than || in some situations which is
contrary to the manual.  This exception is not noted as far as I can tell.

var_dump(!$test = false || !$test2 = false);
is being interpreted like this
var_dump(!$test = (false || !$test2 = false));
instead of like this
var_dump((!$test = false) || (!$test2 = false));

If I missed something my apologies.

Thanks,
Michael D. Nelson

Reproduce code:
---------------
---
>From manual page: language.operators.precedence
---
var_dump(!$test = false || !$test2 = false);
echo "TEST\n";
var_dump($test);
echo "TEST2\n";
var_dump($test2);

Expected result:
----------------
bool(true)
TEST
bool(false)
TEST2
NULL

Actual result:
--------------
bool(false)
TEST
bool(true)
TEST2
bool(false)

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

Reply via email to