Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004062 [Quercus] block always 06-02-10 02:45 06-02-10 05:52
Reporter sblommers View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 4.0.8
Summary 0004062: Quercus array() type check on != not fully compatible with PHP
Description When checking the following:

$var = array();
$var != "" => FALSE (but should be TRUE)
$var != true => FALSE (but should also be TRUE)

$var2 = array("A", "B");
$var2 != true => TRUE (but this should be FALSE)
Additional Information
Attached Files

- Relationships

- Notes
(0004628)
sblommers
06-02-10 05:52

I managed to workaround this issue by checking more conditions in the ArrayValue.eq method. This diff is against latest SVN https://streamconsulting.nl/drop/ArrayValue_eq.diff [^]

pasted:

diff -r fb8b246a91cb modules/quercus/src/com/caucho/quercus/env/ArrayValue.java
--- a/modules/quercus/src/com/caucho/quercus/env/ArrayValue.java Wed Jun 02 11:53:51 2010 +0200
+++ b/modules/quercus/src/com/caucho/quercus/env/ArrayValue.java Wed Jun 02 14:48:49 2010 +0200
@@ -1415,10 +1415,14 @@
   @Override
   public boolean eq(Value rValue)
   {
- if (rValue == null)
+ if (rValue == null || rValue instanceof ConstStringValue || rValue instanceof DoubleValue || rValue instanceof LongCacheValue)
       return false;
+
+ final Set<Map.Entry<Value,Value>> entryset = entrySet();
+ if (rValue instanceof BooleanValue)
+ return entryset.size() > 0 ? rValue.toBoolean() : !rValue.toBoolean();
 
- for (Map.Entry<Value, Value> entry: entrySet()) {
+ for (Map.Entry<Value, Value> entry: entryset) {
       Value entryValue = entry.getValue();
 
       Value entryKey = entry.getKey();
 

- Issue History
Date Modified Username Field Change
06-02-10 02:45 sblommers New Issue
06-02-10 05:52 sblommers Note Added: 0004628
06-04-10 08:03 sblommers Issue Monitored: sblommers


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker