Since 5.3.1 it's impossible to have a reference parameter passed to a
__call() function. This is apparently due to the bugfix committed by
stas as shown here:
Test cases can be found here: http://bugs.php.net/bug.php?id=50394. It
seems to me that a special case would be needed to restore the behaviour
seen in PHP 5.3.0.
This change causes bugs in MediaWiki, where an attempt by a proxy object
to pass a call through to a function that accepts reference parameters
will always fail, due to the exacerbating change made to reference
argument semantics in PHP 5.3.0.
If we want MediaWiki to support PHP 5.3.1, we'll have to do some major
changes, like abandoning __call entirely, or rewriting all the relevant
interfaces to not use reference parameters. I'm not too keen about doing
this without getting some indication from the PHP dev team as to whether
this change is permanent or whether it will be fixed in an imminent PHP
5.3.2 release. If it's going to be fixed soon, we can just blacklist PHP
5.3.1 in our installer.
I've tried emailing stas but I didn't get a reply.
-- Tim Starling
Hi!
Test cases can be found here:http://bugs.php.net/bug.php?id=50394. It
seems to me that a special case would be needed to restore the behaviour
seen in PHP 5.3.0.
I'll check it out, seems to be valid use case, we should find some
solution for that.
I've tried emailing stas but I didn't get a reply.
Sorry, I didn't see any email from you.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stanislav Malyshev wrote:
Hi!
Test cases can be found here:http://bugs.php.net/bug.php?id=50394. It
seems to me that a special case would be needed to restore the behaviour
seen in PHP 5.3.0.I'll check it out, seems to be valid use case, we should find some
solution for that.
There seems to have been no progress on this. Is there anything I can do
to help?
-- Tim Starling
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello Tim,
There seems to have been no progress on this. Is there anything I can do
to help?
just for the record: why does MediaWiki rely on a feature
"Call-Time-Pass-By-Reference" that is deprecated since PHP 4.0.0 <-
Yes exactly 4.0.0
What happened between 5.3.0 and 5.3.1 is that stas killed that feature
for internal functions to work around a big security problem in the
design of the Zend Engine.
Considering the fact that the feature is DEPRECATED since 4.0.0 it
would even be okay to kill it for all functions.
Stefan Esser
SektionEins GmbH stefan.esser@sektioneins.de
Eupener Straße 150 Tel: 0221 / 29282931
50933 Köln Fax: 0221 / 29282935
http://SektionEins.de/
Firmensitz Eupener Straße 150 50933 Köln
Registergericht Amtsgericht Köln HRB 59950
Geschäftsführer Johann-Peter Hartmann
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAksp0bcACgkQSuF5XhWr2nhdwQCggzxIUz8N7ZlRLWWklTqJBnPO
BSoAniiOqs2JXyh4iNwRtp9FiGRIy/16
=q9+2
-----END PGP SIGNATURE
I agree that this feature should be avoided in userland, but I think
that it would be terrible, if this "bugfix" would stay this way,
because this breaks backward compatibility -without notification- with
a minor version update both in 5.3 and 5.2 branch.
Tyrael
On Thu, Dec 17, 2009 at 7:37 AM, Stefan Esser
stefan.esser@sektioneins.de wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Hello Tim,
There seems to have been no progress on this. Is there anything I can do
to help?
just for the record: why does MediaWiki rely on a feature
"Call-Time-Pass-By-Reference" that is deprecated since PHP 4.0.0 <-
Yes exactly 4.0.0What happened between 5.3.0 and 5.3.1 is that stas killed that feature
for internal functions to work around a big security problem in the
design of the Zend Engine.
Considering the fact that the feature is DEPRECATED since 4.0.0 it
would even be okay to kill it for all functions.Stefan Esser
SektionEins GmbH stefan.esser@sektioneins.de
Eupener Straße 150 Tel: 0221 / 29282931
50933 Köln Fax: 0221 / 29282935
http://SektionEins.de/Firmensitz Eupener Straße 150 50933 Köln
Registergericht Amtsgericht Köln HRB 59950
Geschäftsführer Johann-Peter Hartmann
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/iEYEARECAAYFAksp0bcACgkQSuF5XhWr2nhdwQCggzxIUz8N7ZlRLWWklTqJBnPO
BSoAniiOqs2JXyh4iNwRtp9FiGRIy/16
=q9+2
-----END PGP SIGNATURE
Hi,
because this breaks backward compatibility -without notification- with
a minor version update both in 5.3 and 5.2 branch.
well actually the bug was thatcall_user_func_array()
did not trigger
the "what you do is deprecated warning".
Calling the function directly would have resulted in a "this is
deprecated" warning anyway.
Stefan Esser
--
SektionEins GmbH stefan.esser@sektioneins.de
Eupener Straße 150 Tel: 0221 / 29282931
50933 Köln Fax: 0221 / 29282935
http://SektionEins.de/
Firmensitz Eupener Straße 150 50933 Köln
Registergericht Amtsgericht Köln HRB 59950
Geschäftsführer Johann-Peter Hartmann
As tsarling stated in the bugreport:
http://bugs.php.net/bug.php?id=50394
"I'm not complaining about the
warning, which I just added to demonstrate the problem. I'm not
complaining about the new behaviour of zend_call_function() as of PHP
5.3.0, I'm complaining about the lost reference in __call in PHP 5.3.1."
Tyrael
On Thu, Dec 17, 2009 at 9:54 AM, Stefan Esser
stefan.esser@sektioneins.de wrote:
Hi,
because this breaks backward compatibility -without notification- with
a minor version update both in 5.3 and 5.2 branch.
well actually the bug was thatcall_user_func_array()
did not trigger
the "what you do is deprecated warning".
Calling the function directly would have resulted in a "this is
deprecated" warning anyway.Stefan Esser
--
SektionEins GmbH stefan.esser@sektioneins.de
Eupener Straße 150 Tel: 0221 / 29282931
50933 Köln Fax: 0221 / 29282935
http://SektionEins.de/Firmensitz Eupener Straße 150 50933 Köln
Registergericht Amtsgericht Köln HRB 59950
Geschäftsführer Johann-Peter Hartmann
Hi!
Test cases can be found here:http://bugs.php.net/bug.php?id=50394. It
seems to me that a special case would be needed to restore the behaviour
seen in PHP 5.3.0.I'll check it out, seems to be valid use case, we should find some
solution for that.There seems to have been no progress on this. Is there anything I can do
to help?
Tim, could you check if the attached patch solves your problem?
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stanislav Malyshev wrote:
Tim, could you check if the attached patch solves your problem?
Yes, it works for me, in both the isolated test case and the original MW
bug.
MW's parser test suite shows 4 failing tests in 5.3.1, all fixed with
this patch and no new regressions.
Stefan Esser wrote:
just for the record: why does MediaWiki rely on a feature
"Call-Time-Pass-By-Reference" that is deprecated since PHP 4.0.0 <-
Yes exactly 4.0.0
The underlying functions are declared with reference parameters, and we
call them with call_user_func_array()
so explicitly creating references
on the caller side is required. If you have a better method for calling
arbitrary functions that accept reference parameters, let me know.
Lots of MediaWiki functions are declared with reference parameters for
objects when they aren't really needed, because that was the required
convention in PHP 4, and we never made a concerted effort to remove all
the ampersands. It's too late to fix it now, in many cases, because many
extensions declare hook functions with reference parameters, following
the caller and documentation that dates from PHP 4, and so we have to
keep passing them reference parameters to avoid breaking them in PHP
5.3+. So the window for easy migration to value parameters has closed.
-- Tim Starling
Hi!
Yes, it works for me, in both the isolated test case and the original MW
bug.MW's parser test suite shows 4 failing tests in 5.3.1, all fixed with
this patch and no new regressions.
Great, will commit the patch tomorrow then to all branches.
The underlying functions are declared with reference parameters, and we
call them withcall_user_func_array()
so explicitly creating references
on the caller side is required. If you have a better method for calling
arbitrary functions that accept reference parameters, let me know.
call_user_func_array()
wasn't a problem in this particular case, __call
was (see the bug), because internally it's user function call simulated
by internal function call, so it needed some special check.
Lots of MediaWiki functions are declared with reference parameters for
objects when they aren't really needed, because that was the required
Entirely unrelated to this bug, passing objects by-ref is not the best
idea in PHP 5.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Tim Starling wrote:
Since 5.3.1 it's impossible to have a reference parameter passed to a
__call() function.
This change causes bugs in MediaWiki, where an attempt by a proxy object
to pass a call through to a function that accepts reference parameters
will always fail, due to the exacerbating change made to reference
argument semantics in PHP 5.3.0.If we want MediaWiki to support PHP 5.3.1, we'll have to do some major
changes, like abandoning __call entirely, or rewriting all the relevant
interfaces to not use reference parameters. I'm not too keen about doing
this without getting some indication from the PHP dev team as to whether
this change is permanent or whether it will be fixed in an imminent PHP
5.3.2 release. If it's going to be fixed soon, we can just blacklist PHP
5.3.1 in our installer.I've tried emailing stas but I didn't get a reply.
-- Tim Starling
It's also broken in PHP 5.2.11 and 5.2.12 RC4. Works in 5.2.10 and
5.2.11RC1.
Whatever change broke it, was backported and got into 5.2.11RC2.
PS: Did mediawiki opt-out for release candidate announcements? It didn't
receive emails about RCs
for 5.2.12 branch.