Mantis - Quercus
Viewing Issue Advanced Details
2251 major always 12-13-07 12:15 12-17-07 09:38
koreth  
ferg  
normal  
closed 3.1.4  
fixed  
none    
none 3.1.5  
0002251: Bit operators do not do implicit string to integer conversion
<?php
$val = "15";
print ($val & 1) . "\n";

Vanilla PHP prints "1". Quercus prints "0".

Notes
(0002569)
koreth   
12-13-07 12:34   
Patch:

--- a/modules/quercus/src/com/caucho/quercus/env/StringValue.java
+++ b/modules/quercus/src/com/caucho/quercus/env/StringValue.java
@@ -674,7 +674,7 @@ abstract public class StringValue extends Value implements C
       return sb;
     }
     else
- return LongValue.ZERO;
+ return super.bitAnd(rValue);
   }
   
   /*
@@ -704,7 +704,7 @@ abstract public class StringValue extends Value implements C
       return sb;
     }
     else
- return rValue;
+ return super.bitOr(rValue);
   }
   
   /*
@@ -729,7 +729,7 @@ abstract public class StringValue extends Value implements C
       return sb;
     }
     else
- return rValue;
+ return super.bitXor(rValue);
   }
   
   /**
(0002580)
ferg   
12-17-07 09:38   
php/0379, php/0388, php/0398