Commit Graph

5 Commits

Author SHA1 Message Date
Umherirrender 6d4740fa4c Fix call to MathMathMLCli::getError
var_export prints the result,
it needs a true argument to return a string

Change-Id: I3c1275daf465044f1e22548a70e775069a6e94b6
2019-05-31 20:31:51 +02:00
RazeSoldier 27091b55a0 Log STDERR from mathoids cli output
When $wgMathoidCli is misconfigured the error message was misleading.
It was reported that the specified file was not executable, even though
other reasons are possible (e.g., nodejs misconfigured).  

Therefore, we capture STDERR and add it to the error log.

Bug: T198564
Change-Id: I7d0ae0f3ab4789124f9ff1533e7712ca31233f9e
2018-11-21 10:12:00 +00:00
libraryupgrader 2587469834 build: Updating mediawiki/mediawiki-codesniffer to 20.0.0
Change-Id: I4385a05df9b40d4da19f280bd211e8c261d22c41
2018-05-26 04:26:21 +00:00
Thiemo Kreuz 670f0bb8f9 Don't expect objects by reference in hook handlers
The motivation for this patch is to make the code less complex, better
readable, and less brittle.

Example:

public function onExampleHook( Parser &$parser, array &$result ) {
    /* This is the hook handler */
}

In this example the $result array is meant to be manipulated by the
hook handler. Changes should become visible to the caller. Since PHP
passes arrays by value, the & is needed to make this possible.

But the & is misplaced in pretty much all cases where the parameter is
an object. The only reason we still see these & in many hook handlers
is historical: PHP 4 passed objects by value, which potentially caused
expensive cloning. This was prevented with the &.

Since PHP 5 objects are passed by reference. However, this did not
made the & entirely meaningless. Keeping the & means callees are
allowed to replace passed objects with new ones. The & makes it look
like a function might intentionally replace a passed object, which is
unintended and actually scary in cases like the Parser. Luckily all
Hooks::run I have seen so far ignore unintended out-values. So even if
a hook handler tries to do something bad like replacing the Parser
with a different one, this would not have an effect.

Removing the & does not remove the possibility to manipulate the
object. Changes done to public properties are still visible to the
caller.

Unfortunately these & cannot be removed from the callers as long as
there is a single callee expecting a reference. This patch reduces the
number of such problematic callees.

Change-Id: I21d53c989ea487607dc69e6b3365c023ef6729f5
2018-05-15 17:50:08 +02:00
Moritz Schubotz (physikerwelt) 6e28bf8743
Move php source files
Move php source files to scr. This allows jenkins to calculate the test
coverage.

Bug: T126034
Change-Id: If012c6a4fce0fdeaa5a63dad23210a42d1fc80e6
2018-04-23 15:09:23 +02:00