Page MenuHomePhabricator

Fatal errors with recent changes on PHP5
Closed, ResolvedPublic

Description

Author: ibrash

Description:
Generating the recent changes page on PHP 5.0.3RC1 (problem also occurred on
5.0.1 before upgrading) generates errors of the form:

Fatal error: Only variables can be passed by reference in
/path/to/wiki/includes/ChangesList.php on line 494

It appears that makeKnownLinkObj accepts a reference as its first argument
(&$nt) but lines 494, 495 and 503 of ChangesList.php pass in $rc->getTitle()
which is not a variable.

Possible ways to fix:

  • Change makeKnownLinkObj to not use an explicit reference. PHP 5 will pass by

reference automatically but this would cause PHP4 to make a copy of the object.
This inconsistency may preclude this as a solution.

  • Assign $rc->getTitle() to a local variable and pass this instead.

PHP5 Workaround: Setting the zend.ze1_compatibility_mode flag emulates much of
PHP4's object behavior and thus no error is emitted.


Version: 1.4.x
Severity: normal
OS: Linux
Platform: PC

Details

Reference
bz992

Revisions and Commits

Related Objects

StatusSubtypeAssignedTask
ResolvedNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 7:06 PM
bzimport set Reference to bz992.
bzimport added a subscriber: Unknown Object (MLST).

makeKnownLinkObj had used a reference before, so it probably makes the
most sense to use variables in the ChangesList code (which I relatively
recently switched from using text to objects, giving a huge performance
boost to Recentchanges rendering).

It's silly to call the getTitle() function over and over, anyway.

zigger wrote:

Recentchanges works for me with php v5.0.0 under Windows 2000 and
zend.ze1_compatibility_mode = Off

Works for me with PHP 5.0.3RC1 [compiled from source on Linux], stock configuration
(zend.ze1_compatibility_mode = Off according to phpinfo()).

It might be triggered by some particular conditions or configuration options; can you narrow it
down?

Found it, it's only Enhanced Recent Changes mode that has this problem. Will fix.

Fixed by returning a reference from RecentChange::getTitle()

epriestley added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:23 AM