Last modified: 2014-10-27 05:49:52 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T65049, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 63049 - MW 1.19.13 with PHP 5.2 breaks ApiFormatBase.php (due to using anonymous function introduced in PHP 5.3.0)
MW 1.19.13 with PHP 5.2 breaks ApiFormatBase.php (due to using anonymous func...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.19.13
All All
: High major (vote)
: 1.19.x release
Assigned To: Kevin Israel (PleaseStand)
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-24 23:55 UTC by Darren Stephens
Modified: 2014-10-27 05:49 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Darren Stephens 2014-03-24 23:55:21 UTC
At http://www.m3p.com.mt/wiki/*, after applying 1.19.13 patch, attempts by registered users to add items to watch lists fail. Browser console reports following PHP error: 

<br />
<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>[full path redacted]/wiki/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />

There is a section appearing in the patch release for 1.19.13, which patches this file at line 278: the section marked "// Armor links (bug 61362)"
Comment 1 Sam Reed (reedy) 2014-03-25 02:27:50 UTC
https://github.com/wikimedia/mediawiki-core/blob/REL1_19/includes/api/ApiFormatBase.php

reedy@ubuntu64-web-esxi:~/git/mediawiki/core$ php -l includes/api/ApiFormatBase.php
No syntax errors detected in includes/api/ApiFormatBase.php


Looks fine in git and locally when checked out.

Can you paste lines 276 through 284 of includes/api/ApiFormatBase.php?
Comment 2 Kunal Mehta (Legoktm) 2014-03-25 02:44:49 UTC
<http://www.m3p.com.mt/wiki/Special:Version> is running PHP 5.2.17 (1.19 says it works with 5.2.3+ in the release notes). Line 279 has an anonymous function in it, which according to <http://www.php.net/manual/en/functions.anonymous.php> was only introduced in 5.3.0.
Comment 3 Darren Stephens 2014-03-25 09:20:48 UTC
Here we are, as requested:

// Armor links (bug 61362)
$masked = array();
$text = preg_replace_callback( '#<a .*?</a>#', function ( $matches ) use ( &$masked ) {
    $sha = sha1( $matches[0] );
    $masked[$sha] = $matches[0];
    return "<$sha>";
    }, $text );

// identify URLs
$protos = wfUrlProtocolsWithoutProtRel();

And yes, the callback does appear to include an anonymous function. Can also corroborate Knual's interpretation of PHP docs  - anonymous functions only became available in PHP 5.3.0
Comment 4 Mark A. Hershberger 2014-03-25 17:53:40 UTC
pinging Markus.  I saw the anonymous function, but I think I also saw some documentation saying we only supported 5.3 for 1.19.
Comment 5 Alexandre Emsenhuber [IAlex] 2014-04-04 17:35:23 UTC
MediaWiki 1.19 is definitely PHP 5.2.3+ see https://git.wikimedia.org/blob/mediawiki%2Fcore.git/REL1_19/INSTALL
Comment 6 Gerrit Notification Bot 2014-05-11 18:48:37 UTC
Change 132836 had a related patch set uploaded by Kishanio:
Anonymous function removed for backwards compaitibility

https://gerrit.wikimedia.org/r/132836
Comment 7 Gerrit Notification Bot 2014-05-11 23:47:14 UTC
Change 132912 had a related patch set uploaded by Kishanio:
Anonymous function removed for backwards compaitibility

https://gerrit.wikimedia.org/r/132912
Comment 8 Gerrit Notification Bot 2014-05-11 23:50:23 UTC
Change 132836 abandoned by Kishanio:
Anonymous function removed for backwards compaitibility

Reason:
Moved to https://gerrit.wikimedia.org/r/#/c/132912/

https://gerrit.wikimedia.org/r/132836
Comment 9 Nemo 2014-09-14 09:28:28 UTC
Found on several wikis (via mutante's wikistats, bug 44145):

<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>/homepages/16/d11964383/htdocs/mediawiki/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />
<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>/hp/ab/ab/ep/www/www.jiventure.info/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />
<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>/hp/ab/ab/ep/www/www.jiventure.info/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />
<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>/Library/WebServer/Documents/drw/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />
<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>/srv/http/seilbahnlexikon.alpinforum.com/htdocs/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />
<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>/var/www/www.ludd.ltu.se/htdocs/w2/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />
<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>/var/www/www.ludd.ltu.se/htdocs/w2/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />
<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>/vol/www/esmwiki/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />
<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>/vol/www/mmewiki/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />
<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>/web/research/mediawiki/csgsa/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />
<b>Parse error</b>:  syntax error, unexpected T_FUNCTION in <b>/web/research/mediawiki/rsn/includes/api/ApiFormatBase.php</b> on line <b>279</b><br />
Comment 10 Gerrit Notification Bot 2014-10-27 05:47:19 UTC
Change 132912 merged by jenkins-bot:
ApiFormatBase: Remove anonymous functions for PHP 5.2 compatibility

https://gerrit.wikimedia.org/r/132912
Comment 11 Kunal Mehta (Legoktm) 2014-10-27 05:49:52 UTC
Should be fixed for the 1.19.21 release.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links