Reply to Re: [PHP] Wikimedia - php4

Your name:

Reply:


Posted by Rasmus Lerdorf on 09/21/05 07:34

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация