[PHP] Wikimedia - php4
Hi I have just installed wikimedia on freebsd 5.3 with php4-4.4.0. After starting the program after a successful installation I get the error messages shown below. There are three eror from two lines of code. I have included the relevant code. Having just started to learn php, I am not competent to know how to set about solving this. Does anyone here have any idea what may be wrong or do you happen to know of a suitable forum or mailing list that could be helpful Thanks in advance david -- Errors from php4.log *** FIRST Error - reppeated twice: *** 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 ); ^^ } --- *** 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; } __ Thanks in advance david -- 40 yrs navigating and computing in blue waters. English Owner Captain of British Registered 60' bluewater Ketch S/V Taurus. Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after completing engineroom refit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wikimedia - php4
Vizion wrote: Hi I have just installed wikimedia on freebsd 5.3 with php4-4.4.0. I think you mean MediaWiki (common mistake!) After starting the program after a successful installation I get the error messages shown below. There are three eror from two lines of code. I have included the relevant code. [snip] *** FIRST Error - reppeated twice: *** 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 These are coding errors in MediaWiki (but not really bad errors, just enough for PHP to flag a notice); since it's not something you can fix entirely unless you want to trawl through all of their code, the easiest thing to do is change error_reporting in your php.ini file so it looks like this: error_reporting = E_ALL ~E_NOTICE which means show all errors except notices. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wikimedia - php4
On Tuesday 20 September 2005 19:26, the author Vizion contributed to the dialogue on- [PHP] Wikimedia - php4: Hi I have just installed wikimedia on freebsd 5.3 with php4-4.4.0. After starting the program after a successful installation I get the error messages shown below. There are three eror from two lines of code. I have included the relevant code. Having just started to learn php, I am not competent to know how to set about solving this. Does anyone here have any idea what may be wrong or do you happen to know of a suitable forum or mailing list that could be helpful Thanks in advance david -- Errors from php4.log *** FIRST Error - reppeated twice: *** 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 ); ^^ } --- *** 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 Sorry I inserted the wrong source code - this is the correct code: /** * Create the template engine object; we feed it a bunch of data * and eventually it spits out some HTML. Should have interface * roughly equivalent to PHPTAL 0.7. * * @param string $callback (or file) * @param string $repository subdirectory where we keep template files * @param string $cache_dir * @return object * @access private */ function setupTemplate( $classname, $repository=false, $cache_dir=false ) { return new $classname(); ^^ } __ Thanks in advance david -- 40 yrs navigating and computing in blue waters. English Owner Captain of British Registered 60' bluewater Ketch S/V Taurus. Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after completing engineroom refit. -- 40 yrs navigating and computing in blue waters. English Owner Captain of British Registered 60' bluewater Ketch S/V Taurus. Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after completing engineroom refit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wikimedia - php4
On Tuesday 20 September 2005 19:37, the author Jasper Bryant-Greene contributed to the dialogue on- Re: [PHP] Wikimedia - php4: Vizion wrote: Hi I have just installed wikimedia on freebsd 5.3 with php4-4.4.0. I think you mean MediaWiki (common mistake!) After starting the program after a successful installation I get the error messages shown below. There are three eror from two lines of code. I have included the relevant code. [snip] *** FIRST Error - reppeated twice: *** 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 These are coding errors in MediaWiki (but not really bad errors, just enough for PHP to flag a notice); since it's not something you can fix entirely unless you want to trawl through all of their code, the easiest thing to do is change error_reporting in your php.ini file so it looks like this: error_reporting = E_ALL ~E_NOTICE which means show all errors except notices. You are fast!! Thanks very much for that -- OK - You replied before you will have got my correction -- but I guess your solution will work in any case!! Thanks again -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- 40 yrs navigating and computing in blue waters. English Owner Captain of British Registered 60' bluewater Ketch S/V Taurus. Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after completing engineroom refit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wikimedia - php4
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
Re: [PHP] Wikimedia - php4
Vizion wrote: function setupTemplate( $classname, $repository=false, $cache_dir=false ) { return new $classname(); ^^ } Is that really all they have in that function? It seems rather useless to me. Why call a function just to instantiate a class like that? Regardless, here it is trying to create a reference to a temp var. Basically PHP will ignore the reference here, and it should work, but you are getting a notice because the reference is being discarded. Either drop the reference from the function definition or do: $class = new $classname(); return $class; And for PHP5 you can just drop all references related to objects and it will do the right thing. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wikimedia - php4
On Wed, 2005-09-21 at 00:58, Rasmus Lerdorf wrote: And for PHP5 you can just drop all references related to objects and it will do the right thing. Eeeek, that's not entirely true. Sometimes you want a real reference to an object even in PHP5 :/ Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wikimedia - php4
Robert Cummings wrote: On Wed, 2005-09-21 at 00:58, Rasmus Lerdorf wrote: And for PHP5 you can just drop all references related to objects and it will do the right thing. Eeeek, that's not entirely true. Sometimes you want a real reference to an object even in PHP5 :/ $a = new foo(); Will create a reference to the object. $b = $a; Now you have 2 references to the same object. For any sort of normal use, you never need to explicitly create references to objects in PHP 5. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wikimedia - php4
On Wed, 2005-09-21 at 01:08, Rasmus Lerdorf wrote: Robert Cummings wrote: On Wed, 2005-09-21 at 00:58, Rasmus Lerdorf wrote: And for PHP5 you can just drop all references related to objects and it will do the right thing. Eeeek, that's not entirely true. Sometimes you want a real reference to an object even in PHP5 :/ $a = new foo(); Will create a reference to the object. $b = $a; Now you have 2 references to the same object. For any sort of normal use, you never need to explicitly create references to objects in PHP 5. I think you mean novice use. There are certainly times when assigning an object to a variable I want all the values currently referring to that object to see the update and not just the variable being assigned to. I understand that objects in PHP5 are passed by reference under normal assignment, but it's a copy of a reference and not a reference to a reference. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wikimedia - php4
On Tuesday 20 September 2005 22:14, the author Robert Cummings contributed to the dialogue on- Re: [PHP] Wikimedia - php4: On Wed, 2005-09-21 at 01:08, Rasmus Lerdorf wrote: Robert Cummings wrote: On Wed, 2005-09-21 at 00:58, Rasmus Lerdorf wrote: And for PHP5 you can just drop all references related to objects and it will do the right thing. Eeeek, that's not entirely true. Sometimes you want a real reference to an object even in PHP5 :/ $a = new foo(); Will create a reference to the object. $b = $a; Now you have 2 references to the same object. For any sort of normal use, you never need to explicitly create references to objects in PHP 5. I think you mean novice use. There are certainly times when assigning an object to a variable I want all the values currently referring to that object to see the update and not just the variable being assigned to. I understand that objects in PHP5 are passed by reference under normal assignment, but it's a copy of a reference and not a reference to a reference. Cheers, Rob. -- `' Thank you all so much.. Now I do not get the notices and I almost understand what you guys are saying :-) That makes it a good day!! chuckles david -- 40 yrs navigating and computing in blue waters. English Owner Captain of British Registered 60' bluewater Ketch S/V Taurus. Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after completing engineroom refit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wikimedia - php4
Robert Cummings wrote: I think you mean novice use. There are certainly times when assigning an object to a variable I want all the values currently referring to that object to see the update and not just the variable being assigned to. I understand that objects in PHP5 are passed by reference under normal assignment, but it's a copy of a reference and not a reference to a reference. I am not sure I would call it novice use. Normally you simply want to manipulate the object itself. As in: class foo { public $prop = 1; } $a = new foo(); $b = $a; $b-prop++; echo $a-prop; This will of course output 2. Manipulating the object through any of its references will be reflected in all the others as there is just one object here. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wikimedia - php4
On Wed, 2005-09-21 at 01:20, Rasmus Lerdorf wrote: Robert Cummings wrote: I think you mean novice use. There are certainly times when assigning an object to a variable I want all the values currently referring to that object to see the update and not just the variable being assigned to. I understand that objects in PHP5 are passed by reference under normal assignment, but it's a copy of a reference and not a reference to a reference. I am not sure I would call it novice use. Normally you simply want to manipulate the object itself. As in: class foo { public $prop = 1; } $a = new foo(); $b = $a; $b-prop++; echo $a-prop; This will of course output 2. Manipulating the object through any of its references will be reflected in all the others as there is just one object here. Absolutely, but that's the object's properties, but sometimes when assigning a new object, you want all references to the previous object to also be updated. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php