Re: [phplib] php.ini: allow_call_time_pass_reference From: Markus Dobel (mdobel <email protected>)
Date: 05/15/01

On Tue, May 15, 2001 at 03:55:07PM +0200, Stefan Jösch wrote:
>
> Any Solutions for changing code in PHPLIB, so that I can turn off this value
> in php.ini?

There are tree parts of PHPlib which do a pass by reference at
function-call time. session.inc, layout_html.inc and db_odbc.inc. This
is just a fix for session.inc.

Declare the function serialize "call-by-reference" and change the lines
calling this function. I did not test it, but in theory it should work
smoothly like this:

--- session.inc.orig Tue May 15 16:24:05 2001
+++ session.inc Tue May 15 16:25:01 2001
@@ -235,7 +235,7 @@
     print $this->add_query($qarray);
   }
 
- ## serialize($prefix,&$str):
+ ## serialize($prefix,$str):
   ##
   ## appends a serialized representation of $$prefix
   ## at the end of $str.
@@ -246,7 +246,7 @@
   ## to be saved as an array of strings).
   ##
   ## You don't need to know...
- function serialize($prefix, $str) {
+ function serialize($prefix, &$str) {
     static $t,$l,$k;
 
     ## Determine the type of $$prefix
@@ -259,7 +259,7 @@
         $str .= "\$$prefix = array(); ";
         while ( "array" == $l ) {
           ## Structural recursion
- $this->serialize($prefix."['".ereg_replace("([\\'])", "\\\\1", $k)."']", &$str);
+ $this->serialize($prefix."['".ereg_replace("([\\'])", "\\\\1", $k)."']", $str);
           eval("\$l = gettype(list(\$k)=each(\$$prefix));");
         }
 
@@ -270,7 +270,7 @@
         $str.="\$$prefix = new $k; ";
         while ( $l ) {
           ## Structural recursion.
- $this->serialize($prefix."->".$l,&$str);
+ $this->serialize($prefix."->".$l,$str);
           eval("\$l = next(\$${prefix}->persistent_slots);");
         }
 
@@ -301,14 +301,14 @@
   function freeze() {
     $str="";
 
- $this->serialize("this->in",&$str);
- $this->serialize("this->pt",&$str);
+ $this->serialize("this->in",$str);
+ $this->serialize("this->pt",$str);
 
     reset($this->pt);
     while ( list($thing) = each($this->pt) ) {
       $thing=trim($thing);
       if ( $thing ) {
- $this->serialize("GLOBALS['".$thing."']",&$str);
+ $this->serialize("GLOBALS['".$thing."']",$str);
       }
     }
     

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>