Mantis - Quercus
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
607 | minor | always | 12-31-05 05:59 | 01-03-06 20:46 | |
|
|||||
Reporter: | bago | Platform: | |||
Assigned To: | OS: | ||||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | |||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 3.0.18 | ||
|
|||||
Summary: | 0000607: func_get_args should copy the values and not use references! | ||||
Description: |
http://www.php.net/func_get_args [^] "Note: This function returns a copy of the passed arguments only, and does not account for default (non-passed) arguments." |
||||
Steps To Reproduce: |
<?php function mixedargs() { $args = func_get_args(); $args[0]['a'] = "byreference"; } $test = array('a'=>"byvalue"); mixedargs($test); print($test['a']); ?> in original php this output "byvalue", in quercus this output "byreference". Here is a patch (I still don't know very well the quercus codebase, maybe this is not correct, but it fixed my problem). Index: modules/quercus/src/com/caucho/quercus/lib/QuercusFunctionModule.java =================================================================== --- modules/quercus/src/com/caucho/quercus/lib/QuercusFunctionModule.java (revision 493) +++ modules/quercus/src/com/caucho/quercus/lib/QuercusFunctionModule.java (working copy) @@ -120,7 +120,7 @@ Value []args = env.getFunctionArgs(); if (0 <= index && index < args.length) - return args[index]; + return args[index].copy(); else { // XXX: warning return NullValue.NULL; @@ -137,7 +137,7 @@ ArrayValue result = new ArrayValueImpl(); for (int i = 0; i < args.length; i++) - result.append(args[i]); + result.append(args[i].copy()); return result; } |
||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|