Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003199 [Quercus] minor always 12-28-08 13:37 12-29-08 10:33
Reporter koreth View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.0 Product Version 4.0.0
  Product Build
Summary 0003199: Static array passed as argument to function in another file loses copy-on-write in compiled mode
Description lookup.php:

<?php
function lookup($arr, $idx) {
  return $arr[$idx];
}


test.php:

<?php
include_once 'lookup.php';

class Foo {
  public $attrs = array();
  public function gimme() {
    static $val = array('x' => array());
    $this->attrs['x'] = lookup($val, 'x');
  }
}

$foo = new Foo();
$foo->gimme();
print "Before: ";
print_r($foo->attrs);
print "
\n";

$foo->attrs['x'][] = 'z';

$foo = new Foo();
$foo->gimme();
print "After: ";
print_r($foo->attrs);


Regular PHP, and Quercus in interpreted mode, prints

Before: Array ( [x] => Array ( ) )
After: Array ( [x] => Array ( ) )

Quercus in compiled mode prints

Before: Array ( [x] => Array ( ) )
After: Array ( [x] => Array ( [0] => z ) )

If you move the function to the same source file as the test, the problem goes away.
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0003681)
ferg
12-29-08 10:33
edited on: 12-29-08 10:34

php/347b

 

- Issue History
Date Modified Username Field Change
12-28-08 13:37 koreth New Issue
12-29-08 10:33 ferg Note Added: 0003681
12-29-08 10:33 ferg Assigned To  => ferg
12-29-08 10:33 ferg Status new => closed
12-29-08 10:33 ferg Resolution open => fixed
12-29-08 10:33 ferg Fixed in Version  => 4.0.0
12-29-08 10:34 ferg Note Edited: 0003681


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