Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003130 [Quercus] minor always 12-06-08 12:51 12-10-08 09:15
Reporter koreth View Status public  
Assigned To nam
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.0 Product Version 3.2.1
  Product Build
Summary 0003130: array_fill() should copy, not reference, values
Description Similar to bug 2930:

<?php
$x = array_fill(0, 2, array());
$x[0][] = 'foo';
print_r($x);

This prints

Array
(
    [0] => Array
        (
            [0] => foo
        )

    [1] => Array
        (
            [0] => foo
        )

)

The second child array should be empty. The fix is similar to the previous bug's:

--- a/modules/quercus/src/com/caucho/quercus/lib/ArrayModule.java
+++ b/modules/quercus/src/com/caucho/quercus/lib/ArrayModule.java
@@ -537,7 +537,7 @@ public class ArrayModule
     ArrayValue array = new ArrayValueImpl();
 
     for (long k = start; k < num + start; k++)
- array.put(LongValue.create(k), value);
+ array.put(LongValue.create(k), value.copy());
 
     return array;
   }
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0003592)
nam
12-10-08 09:15

php/171a
 

- Issue History
Date Modified Username Field Change
12-06-08 12:51 koreth New Issue
12-10-08 09:15 nam Status new => assigned
12-10-08 09:15 nam Assigned To  => nam
12-10-08 09:15 nam Status assigned => closed
12-10-08 09:15 nam Note Added: 0003592
12-10-08 09:15 nam Resolution open => fixed
12-10-08 09:15 nam Fixed in Version  => 4.0.0


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