Re: Wikimedia - php4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vizion wrote:
> Notice: Only variable references should be returned by reference 
> in /usr2/virtualwebs/forumkatrina.org/wiki/includes/ObjectCache.php on line 
> 369
> 
> Notice: Only variable references should be returned by reference 
> in /usr2/virtualwebs/forumkatrina.org/wiki/includes/ObjectCache.php on line 
> 369
> 
> Line 369 indicated by  ^^^^^^^^^^^^^^^
> -------------------------------------------------------------
> function &_unserialize( $serial ) {
> 		if( function_exists( 'gzinflate' ) ) {
> 			$decomp = @gzinflate( $serial );
> 			if( false !== $decomp ) {
> 				$serial = $decomp;
> 			}
> 		}
> 		return unserialize( $serial );
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 	}

A pretty standard case of someone not really understanding references in
PHP.  There is no need for this function to return a reference.  They
are likely doing it to try to avoid a copy, but no copy will be made in
the standard return by value case.  Simply remove the & from the
function definition to get rid of this notice.


> ---------------------------------------------------------------
> *******************************************************************
> SECOND error -- Error line 136 indicated by ^^^^^^^^^^^^^
> *******************************************************************
> Notice: Only variable references should be returned by reference 
> in /usr2/virtualwebs/forumkatrina.org/wiki/includes/SkinTemplate.php on line 
> 136
> 
> 	function decr($key, $value=1) {
> 		if ( !$this->lock($key) ) {
> 			return false;
> 		}
> 		$value = intval($value);
> 		if($value < 0) $value = 0;
> 
> 		$m = false;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 		if( ($n = $this->get($key)) !== false ) {
> 			$m = $n - $value;
> 			if($m < 0) $m = 0;
> 			$this->set($key, $m); // exptime?
> 		}
> 		$this->unlock($key);
> 		return $m;
> 	}

Are you sure you have the right code snippet here?  That's not a return
line and I see no references there.

-Rasmus

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux