Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003372 [Quercus] block always 03-05-09 18:54 03-06-09 13:39
Reporter koreth View Status public  
Assigned To nam
Priority normal Resolution fixed  
Status closed   Product Version 4.0.0
Summary 0003372: Refs not preserved
Description <?php

function setup(&$pending=null) {
  $GLOBALS['LIST'][] = array(
    'ref' => &$pending,
  );
}

function dispatch() {
  foreach ($GLOBALS['LIST'] as $entry) {
    $ref = &$entry['ref'];
    $ref = 'xyzzy';
  }
}

$x = null;
setup($x);
dispatch();
print strlen($x);

Regular PHP prints "5". Quercus prints "0" -- somewhere along the line it loses the fact that it's dealing with a reference, and no value gets assigned to $x.
Additional Information
Attached Files

- Relationships

- Notes
(0003865)
koreth
03-05-09 22:43

This change to ArrayValueImpl.getRef(Value) seems to fix the test case, but it is most likely not the right fix (I imagine the Var-rewrapping logic was there for a reason.)

--- a/modules/quercus/src/com/caucho/quercus/env/ArrayValueImpl.java
+++ b/modules/quercus/src/com/caucho/quercus/env/ArrayValueImpl.java
@@ -944,7 +944,7 @@ public class ArrayValueImpl extends ArrayValue
       return var;
     
     if (entry._value instanceof Var)
- var = new Var(entry._value.toValue());
+ var = (Var) entry._value;
     else
       var = new Var(entry._value);
 
(0003868)
nam
03-06-09 13:39

php/066y
 

- Issue History
Date Modified Username Field Change
03-05-09 18:54 koreth New Issue
03-05-09 22:43 koreth Note Added: 0003865
03-06-09 13:34 nam Status new => assigned
03-06-09 13:34 nam Assigned To  => nam
03-06-09 13:39 nam Status assigned => closed
03-06-09 13:39 nam Note Added: 0003868
03-06-09 13:39 nam Resolution open => fixed
03-06-09 13:39 nam Fixed in Version  => 4.0.0


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