When calling, for example:
$wgParser->startExternalParse( $wgTitle, $popt, Parser::OT_WIKI );
If $wgParser is a stub, it will invoke StubObject::__call() passing the
first argument ($wgTitle) by value. $wgParser will be unstubbed, and
then call_user_func_array() will then call Parser::startExternalParse
passing the argument by value, which will break since the first argument
is a reference.
PHP Warning: Parameter 1 to
Parser::startExternalParse() expected to
be a reference, value given in .../includes/StubObject.php on line 58
Passing &$wgTitle instead (although considered obsolete) works for some
versions of PHP, for others, it breaks in a different way:
PHP Warning: Call-time pass-by-reference has been
deprecated; If you
would like to pass it by reference, modify the declaration of [runtime
function name](). If you would like to enable call-time
pass-by-reference, you can set allow_call_time_pass_reference to true
in your INI file in ... on line ...
The documentation on StubObject seems to suggest that the mechanism
should be transparent. Currently, the only way I could find to do this
call is to test the object with StubObject::isRealObject() and then
manually call $wgParser->_unstub(), which is hardly "transparent". And
it is also hard to predict every single place that you may happen to be
dealing with a stub object.
Am I missing something? What is the correct way to call a method with a
pass-by-reference argument on a stub object?
Regards,
--
Juliano F. Ravasi ยทยท
http://juliano.info/
5105 46CC B2B7 F0CD 5F47 E740 72CA 54F4 DF37 9E96