+openid-code list<div><br></div><div>we currently have two pull requests in the queue pertaining to fixing references in PHP5:</div><div><br></div><div><a href="https://github.com/openid/php-openid/pull/44">https://github.com/openid/php-openid/pull/44</a></div>
<div><a href="https://github.com/openid/php-openid/pull/68">https://github.com/openid/php-openid/pull/68</a><br><br>#68 only has one actual substantive change, plus a lot of whitespace changes. To folks on the code list: has anyone actually sat down and verified that the changes in #44 are all correct (see my comment earlier in this thread below)? It may be totally fine, I just haven't had time to trace through each individual change.</div>
<div><br></div><div>Cash: you mention that one of them is definitely fine. Could you look through the others in #44 as well to verify, and reply on the pull request.<br><br>-will</div><div><br><div class="gmail_quote">On Mon, Feb 6, 2012 at 4:07 PM, Cash Costello <span dir="ltr"><<a href="mailto:cash.costello@gmail.com">cash.costello@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Interestingly enough, the MediaWiki OpenID plugin distributes a patch for this issue (see note under requisite 1): <a href="http://www.mediawiki.org/wiki/Extension:OpenID" target="_blank">http://www.mediawiki.org/wiki/Extension:OpenID</a><div class="HOEnZb">
<div class="h5"><br>
<br><div class="gmail_quote">On Mon, Feb 6, 2012 at 7:05 PM, Cash Costello <span dir="ltr"><<a href="mailto:cash.costello@gmail.com" target="_blank">cash.costello@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
These look like cases of code not being updated for PHP 5. <br><br>Take Auth_OpenID_GenericConsumer::complete() as an example:<br><br><pre><div> <span>function</span> <span>complete</span><span>(</span><span>$message</span><span>,</span> <span>$endpoint</span><span>,</span> <span>$return_to</span><span>)</span></div>
<div> <span>{</span></div><div> <span>$mode</span> <span>=</span> <span>$message</span><span>-></span><span>getArg</span><span>(</span><span>Auth_OpenID_OPENID_NS</span><span>,</span> <span>'mode'</span><span>,</span></div>
<div> <span>'<no mode set>'</span><span>);</span></div><div><br></div><div> <span>$mode_methods</span> <span>=</span> <span>array</span><span>(</span></div>
<div> <span>'cancel'</span> <span>=></span> <span>'_complete_cancel'</span><span>,</span></div><div>
<span>'error'</span> <span>=></span> <span>'_complete_error'</span><span>,</span></div><div> <span>'setup_needed'</span> <span>=></span> <span>'_complete_setup_needed'</span><span>,</span></div>
<div> <span>'id_res'</span> <span>=></span> <span>'_complete_id_res'</span><span>,</span></div><div>
<span>);</span></div><div><br></div><div> <span>$method</span> <span>=</span> <span>Auth_OpenID</span><span>::</span><span>arrayGet</span><span>(</span><span>$mode_methods</span><span>,</span> <span>$mode</span><span>,</span></div>
<div> <span>'_completeInvalid'</span><span>);</span></div><div><br></div><div> <span>return</span> <span>call_user_func_array</span><span>(</span><span>array</span><span>(</span><span>$this</span><span>,</span> <span>$method</span><span>),</span></div>
<div> <span>array</span><span>(</span><span>$message</span><span>,</span> <span>&</span><span>$endpoint</span><span>,</span> <span>$return_to</span><span>));</span></div>
<div> <span>}<br><br></span><span><br></span></div></pre>$endpoint is an object so it passed by reference to the complete() method. It will also be passed by reference to whatever method call_user_func_array() is calling. It does not need to be explicit in PHP 5.<span><font color="#888888"><br>
<br>Cash</font></span><div><div><br><br><div class="gmail_quote">On Mon, Feb 6, 2012 at 6:22 PM, Jan Hauke Rahm <span dir="ltr"><<a href="mailto:jhr@debian.org" target="_blank">jhr@debian.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Mon, Feb 06, 2012 at 02:58:35PM -0800, Will Norris wrote:<br>
> +Cash, who was looking at merging in some of the existing pending pull<br>
> requests.<br>
<br>
</div>Cool.<br>
<div><br>
> One of the reasons I haven't merged in the reference pull requests is that I<br>
> think they did exactly what you're describing... wholesale dropping all '&',<br>
> which I don't think is the right thing. References are still supported in<br>
> PHP5, just not in the same way as PHP4. While simply dropping all references<br>
> does of course get rid of the warnings and errors from more recent versions of<br>
> PHP, it also potentially has significant changes in what the library is doing.<br>
<br>
</div>Well, as I understand the actual issue here: call-by-reference is not<br>
really going away but the syntax changed. A function can be declared to<br>
take references but it (formerlly should, now) must not be called with<br>
references. That means, the behavior won't change unless the function<br>
was declared wrong.<br>
<br>
The issues here are regarding call_user_func and call_user_func_array<br>
which are defined to take multiple arguments. [1] Wether they internally<br>
make references or not, I don't know. According to [1], one can pass the<br>
arguments without problem and prior to php 5.3 the referencing syntax<br>
was also valid.<br>
<br>
[1] <a href="http://de.php.net/call_user_func" target="_blank">http://de.php.net/call_user_func</a><br>
<div><br>
> I simply haven't had the time to sit down and work through the code to see if<br>
> switching from passing references to passing values is okay (not sure if the<br>
> methods are actually modifying the objects in any way that the external caller<br>
> is expecting to see the result of... and there's a lot of indirection in there<br>
> to trace through to make sure). I'm also not convinced that person who<br>
> submitted the pull request has actually gone through this exercise either, and<br>
> unfortunately, we don't have good working unit tests to verify that the changes<br>
> don't break things... but that's a whole 'nother problem. If someone is<br>
> willing to actually go through and verify that it *really* is doing the right<br>
> thing, I'd be happy to merge the request.<br>
<br>
</div>Well, I'm afraid I'll have to test php-openid against php 5.4 a bit<br>
anyways. Be sure, if I encounter any issues, I'll contact you, with<br>
patches if possible.<br>
<br>
Thanks much for your fast response!<br>
<span><font color="#888888"><br>
Hauke<br>
</font></span><div><div><br>
> On Mon, Feb 6, 2012 at 2:46 PM, Jan Hauke Rahm <<a href="mailto:jhr@debian.org" target="_blank">jhr@debian.org</a>> wrote:<br>
><br>
> Hi Will,<br>
><br>
> I'm the Debian developer maintaining php-openid in Debian. We're<br>
> currently planning to transition to php 5.4 for Debian's next release<br>
> and this will break php-openid as it currently is.<br>
><br>
> The Debian bugs (duplicates as it seems) [1] refer to the<br>
> call-by-reference stuff that is going away in 5.4 as well as the dl()<br>
> stuff. The latter seems to be resolved by your recent merge on github,<br>
> the former is still open.<br>
><br>
> I'm curious, are you going to fix the call-by-reference stuff soon? I<br>
> could provide a patch, though it's realls just a s/&// in a handful of<br>
> cases if I'm not too wrong. And, incidently, are you going to release a<br>
> new version of php-openid? A 2.2.3 or something?<br>
><br>
> I'd appreciate a short answer just so I can plan ahead. I'd hate to have<br>
> Debian differ from your code too much. Thanks anyways for keeping the<br>
> code alive!<br>
><br>
> Hauke<br>
><br>
> [1] <a href="http://bugs.debian.org/php-openid" target="_blank">http://bugs.debian.org/php-openid</a><br>
><br>
> --<br>
> .''`. Jan Hauke Rahm <<a href="mailto:jhr@debian.org" target="_blank">jhr@debian.org</a>> <a href="http://www.jhr-online.de" target="_blank">www.jhr-online.de</a><br>
> : :' : Debian Developer <a href="http://www.debian.org" target="_blank">www.debian.org</a><br>
> `. `'` Member of the Linux Foundation <a href="http://www.linux.com" target="_blank">www.linux.com</a><br>
> `- Fellow of the Free Software Foundation Europe <a href="http://www.fsfe.org" target="_blank">www.fsfe.org</a><br>
><br>
><br>
<br>
--<br>
.''`. Jan Hauke Rahm <<a href="mailto:jhr@debian.org" target="_blank">jhr@debian.org</a>> <a href="http://www.jhr-online.de" target="_blank">www.jhr-online.de</a><br>
: :' : Debian Developer <a href="http://www.debian.org" target="_blank">www.debian.org</a><br>
`. `'` Member of the Linux Foundation <a href="http://www.linux.com" target="_blank">www.linux.com</a><br>
`- Fellow of the Free Software Foundation Europe <a href="http://www.fsfe.org" target="_blank">www.fsfe.org</a><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br></div>