09.15 -rakkaus:#mediawiki-i18n- [17-Oct-2013 07:15:15 UTC] PHP Fatal error: Only variables can be passed by reference in /www/translatewiki.net/w/extensions/SemanticMediaWiki/includes/api/ApiBrowse.php on line 122
Version: master
Severity: normal
09.15 -rakkaus:#mediawiki-i18n- [17-Oct-2013 07:15:15 UTC] PHP Fatal error: Only variables can be passed by reference in /www/translatewiki.net/w/extensions/SemanticMediaWiki/includes/api/ApiBrowse.php on line 122
Version: master
Severity: normal
This is strange, neither Jenkins nor Travis kicked in since this part is covered [1]. Do you have the full stack trace?
I don't. And I do not know how to reliable reproduce this, so it is difficult to get one.
I try using [1].
[1] https://translatewiki.net/w/api.php?action=browse&subject=Main_Page
(In reply to comment #3)
I try using [1].
[1] https://translatewiki.net/w/api.php?action=browse&subject=Main_Page
I'm already asleep. Of course, I meant "I tried".
While fixing the issue shouldn't be the issue here, I'm more interested into why the unit tests didn't raise a flag on both CI's (Jenkins and Travis).
(In reply to comment #3)
I tr[ied] using [1].
[1] https://translatewiki.net/w/api.php?action=browse&subject=Main_Page
Yes, that produces it. :)
Not sure if this helps (missing params) but pasting anyway:
[17-Oct-2013 13:36:01 UTC] <ul>
<li>ApiBrowse.php line 122 calls wfBacktrace()</li>
<li>ApiBrowse.php line 97 calls SMW\ApiBrowse->addIndexTags()</li>
<li>ApiBrowse.php line 28 calls SMW\ApiBrowse->runFormatter()</li>
<li>ApiMain.php line 834 calls SMW\ApiBrowse->execute()</li>
<li>ApiMain.php line 380 calls ApiMain->executeAction()</li>
<li>ApiMain.php line 351 calls ApiMain->executeActionWithErrorHandling()</li>
<li>api.php line 73 calls ApiMain->execute()</li>
</ul>
The following [1] should do the trick but I'd like to have the tests failing first before making any attempt on fixing this.
$tag =& $serialized['data'][ $key ]['dataitem'];
$this->getResult()->setIndexedTagName( $tag, 'value' );
After looking into it, two issue came into play as to way the unit tests didn't catch the issue.
The first issue was caused by PHP 5.3 (I used and old 5.3.8 to verify the issue) which handles pass-by-reference for empty arrays differently and secondly $this->getResult()->setIndexedTagName() (responsible to add '_element' for XML output) applies internally a check whether getIsRawMode() is true/false which in case of the current unit test returns false and therefore will not engage in any array manipulation.
By setting $this->getResult()->setRawMode() in the unit test the error is caught which means I'll have to adjust the unit test in order to incorporate the setRawMode() option before fixing the issue which is doing an additional is_array() check.
Change 90389 had a related patch set uploaded by Mwjames:
(#bug 55826) Force ApiBrowse unit test to fail