Mantis - Quercus
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
2930 | minor | always | 09-12-08 15:42 | 09-12-08 17:25 | |
|
|||||
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: | 3.2.1 | ||
|
|||||
Summary: | 0002930: array_fill_keys() needs to copy, not reference, values | ||||
Description: |
<?php $foo = array_fill_keys(array('a','b'), array()); $foo['a'][] = 'bar'; print $foo['b'][0]; In Vanilla PHP, this doesn't print anything since $foo['b'] is empty. In Quercus it prints 'bar' because $foo['b'] refers to the same underlying array as $foo['a']. |
||||
Steps To Reproduce: | |||||
Additional Information: |
Patch that seems to fix it: --- a/modules/quercus/src/com/caucho/quercus/lib/ArrayModule.java +++ b/modules/quercus/src/com/caucho/quercus/lib/ArrayModule.java @@ -1998,7 +1998,7 @@ Iterator<Value> iter = keyArray.getValueIterator(env); while (iter.hasNext()) { - array.put(iter.next(), value); + array.put(iter.next(), value.copy()); } return array; |
||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|