RE: [PHP] PHP warning with 4.2

2002-08-09 Thread Ford, Mike [LSS]

 -Original Message-
 From: PHP List [mailto:[EMAIL PROTECTED]]
 Sent: 08 August 2002 19:14
 
 Hi, after upgrading to 4.2, I seem to be getting this warning:
 
 PHP Warning:  Call-time pass-by-reference has been deprecated 
 - argument passed by value;  If you would like to pass it by 
 reference, modify the declaration of [runtime function 
 name]().  If you would like to enable call-time 
 pass-by-reference, you can set allow_call_time_pass_reference 
 to true in your INI file.  However, future versions may not 
 support this any longer.  

That probably means your error-reporting level has changed, since that
warning has been around for some time (since at least 4.0.6 to my certain
knowledge).

 
 on this line:
 OCIFetchInto ( $GLOBALS[oracle_statement], $row, OCI_NUM + 
 OCI_RETURN_NULLS  )
 
 if I can't use $row anymore, what do I do? The warning says 
 that future versions may not support this, so will this 
 function be fixed? Or will this function be dissappearing? 

Simply remove the  -- in fact, you never needed it as the definition of the
OCIFetchInto() function itself specifies that the second argument must be
passed by reference.  The description of OCIFetchInto() in the PHP manual
as:

int OCIFetchInto ( int stmt, array  result [, int mode])

corresponds to a PHP function defined like this:

function OCIFetchInto ( stmt, result, mode=OCI_NUM) 
{
...
}

so the result parameter is *always* passed by reference, whether or not you
put a reference in the call.  This define-time call by reference is *not*
deprecated, and indeed was recommended as the preferred way even before
call-time pass by reference was deprecated.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP warning with 4.2

2002-08-08 Thread Nick Oostveen

You should be able to fix this by changing the function DECLARATION for the 
argument in question to take the variable by reference instead of by value 
(which is the default).

So it should be something like:

OCIFetchInto ( $var1, $rvar2, $var3  )

What you are currently doing is specifying at call-time that I want you to 
accept this variable by reference, even if you are expecting it to be 
passed by value.  This can be very dangerous from a data corruption point 
of view, which is likely why it is being deprecated.

At 11:13 AM 8/8/2002 -0700, PHP List wrote:
Hi, after upgrading to 4.2, I seem to be getting this warning:

PHP Warning:  Call-time pass-by-reference has been deprecated - argument 
passed by value;  If you would like to pass it by reference, modify the 
declaration of [runtime function name]().  If you would like to enable 
call-time pass-by-reference, you can set allow_call_time_pass_reference to 
true in your INI file.  However, future versions may not support this any 
longer.

on this line:
OCIFetchInto ( $GLOBALS[oracle_statement], $row, OCI_NUM + 
OCI_RETURN_NULLS  )

if I can't use $row anymore, what do I do? The warning says that future 
versions may not support this, so will this function be fixed? Or will 
this function be dissappearing?

Thanks for any help.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php