|
Mantis - Quercus
|
|||||
| Viewing Issue Advanced Details | |||||
|
|
|||||
| ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
| 3130 | minor | always | 12-06-08 12:51 | 12-10-08 09:15 | |
|
|
|||||
| Reporter: | koreth | Platform: | |||
| Assigned To: | nam | OS: | |||
| Priority: | normal | OS Version: | |||
| Status: | closed | Product Version: | 3.2.1 | ||
| Product Build: | Resolution: | fixed | |||
| Projection: | none | ||||
| ETA: | none | Fixed in Version: | 4.0.0 | ||
|
|
|||||
| 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: | |||||
| Relationships | |||||
| Attached Files: | |||||
| Notes | |||||
|
|
|||||
|
|
||||