Anonymous | Login | Signup for a new account | 12-17-2024 10:46 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0002930 | [Quercus] | minor | always | 09-12-08 15:42 | 09-12-08 17:25 | ||||
Reporter | koreth | View Status | public | ||||||
Assigned To | nam | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product 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']. |
||||||||
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; |
||||||||
Attached Files | |||||||||
|
Notes | |
(0003435) nam 09-12-08 17:25 |
php/1770 It appears that a couple of other ArrayModule functions may also be affected. |
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed. 26 unique queries executed. |