Page MenuHomePhabricator

PHP 5.1 fatal errors caused by reference passing
Closed, ResolvedPublic

Description

PHP 5.1 has added even more wacky places where using references
causes errors. At least some of these are fixed or worked around on
ORACLE_WORK branch.

We may want to look at where we actually need to be using references
(eg for passing mutable objects in PHP4, and for passing string and
array out-parameters in general) and prune the others.

A simple page view gives:
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/ObjectCache.php on line 110
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/ObjectCache.php on line 115
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/DatabaseFunctions.php on line 52
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Article.php on line 490
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/BagOStuff.php on line 369
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Database.php on line 1435
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Revision.php on line 230
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Database.php on line 1544
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Revision.php on line 161
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Revision.php on line 51
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/SkinTemplate.php on line 136
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Namespace.php on line 124
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Revision.php on line 158
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Revision.php on line 75
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Database.php on line 1435
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Revision.php on line 230
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Database.php on line 1544
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Revision.php on line 161
PHP Notice: Only variable references should be returned by reference in /opt/web/pages/head/includes/Revision.php on line 51
PHP Fatal error: Only variables can be passed by reference in /opt/web/pages/head/includes/SkinTemplate.php on line 542

PHP 4.4.0 gives notices as well, but does not give the fatal error.


Version: 1.5.x
Severity: blocker

Details

Reference
bz2885

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:39 PM
bzimport set Reference to bz2885.
brion created this task.Jul 17 2005, 4:27 AM
brion added a comment.Jul 17 2005, 4:28 AM

(Tested with PHP 5.1.0b3 as CGI on Mac OS X.)

Marking tentatively fixed in CVS HEAD.

I haven't exhaustively tested every feature, but so far so good.

ras wrote:

FYI Search functionality (or at least SearchMySQL.php line 52) is still broken
due to this in 1.5b4 which seems to have been rolled after the fix.

Kit_patterson wrote:

MediaWiki: 1.5rc3
PHP: 5.1.0RC1 (apache2handler)
MySQL: 5.0.11-beta-nt

Fatal error: Only variables can be passed by reference in C:\Program Files\mediawiki-1.5rc3
\includes\SearchMySQL.php on line 52
Fatal error: Only variables can be passed by reference in C:\Program Files\mediawiki-1.5rc3
\includes\SpecialLog.php on line 166
Fatal error: Only variables can be passed by reference in C:\Program Files\mediawiki-1.5rc3
\includes\SpecialUndelete.php on line 50

brion added a comment.Aug 28 2005, 9:59 PM

Additionally, SkinTemplate was recently broken completely again on PHP 5.1.

Should all be fixed in current CVS REL1_5 and HEAD now.

brion added a comment.Sep 20 2005, 8:53 AM
  • Bug 3515 has been marked as a duplicate of this bug. ***

dave wrote:

This is still broken for me, in one place.

MediaWiki: 1.5.1
PHP: 5.0.5 (apache)
MySQL: 4.1.14-standard

[29-Oct-2005 15:08:58] PHP Fatal error: Only variables can be passed by
reference in /usr/www/mediawiki/includes/Skin.php on line 541

The offending code exists in both REL1_5 and HEAD (albeit on different line
numbers in HEAD).

brion added a comment.Oct 30 2005, 1:31 AM

Bit from comment 7 now fixed. (Title::equals took a reference parameter but didn't need
to; a bit calling it in newtalk notification for classic skin failed on 5.0.5.)