Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000607 [Quercus] minor always 12-01-05 05:59 01-03-06 20:46
Reporter bago View Status @0@  
Assigned To
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.0.18 Product Version
  Product Build
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
Attached Files

- Relationships

- Notes
(0000622)
bago
12-01-05 06:40

Well, the current trunk after this fix seems to run drupal! :-)
I just tried a few functions but I didn't encounter big problems.
 
(0000634)
ferg
01-03-06 20:46

php/0479, 047a, 3479, 347a
 

- Issue History
Date Modified Username Field Change
12-01-05 05:59 bago New Issue
12-01-05 06:40 bago Note Added: 0000622
01-03-06 20:46 ferg Status new => closed
01-03-06 20:46 ferg Note Added: 0000634
01-03-06 20:46 ferg Resolution open => fixed
01-03-06 20:46 ferg Fixed in Version  => 3.0.18


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