<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="https://forum.yubico.com/feed.php?f=3&amp;t=1081" />

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2013-06-05T15:17:17+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=3&amp;t=1081</id>
<entry>
<author><name><![CDATA[djm03]]></name></author>
<updated>2013-06-05T15:17:17+01:00</updated>
<published>2013-06-05T15:17:17+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1081&amp;p=4022#p4022</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1081&amp;p=4022#p4022"/>
<title type="html"><![CDATA[PEAR::isError($auth) returns FALSE]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1081&amp;p=4022#p4022"><![CDATA[
Hello,<br /><br />I’m using the yubikey with the fellowing script&#058;<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">$yubi = new Auth_Yubico('42', 'FOOBAR=',1,1);<br />$auth = $yubi-&gt;verify($otp);<br />if (PEAR::isError($auth)) {<br />   print &quot;&lt;p&gt;Authentication failed: &quot; . $auth-&gt;getMessage();<br />   print &quot;&lt;p&gt;Debug output from server: &quot; . $yubi-&gt;getLastResponse();<br />} else {<br />   print &quot;&lt;p&gt;You are authenticated!&quot;;<br />}<br /></div><br /><br />If there is an error PEAR::isError($auth) returns FALSE.<br /><br />But $auth-&gt;getMessage() is set, e.g. REPLAYED_OTP.<br /><br />This only concerns when I’m testing this with my web hoster. When testing everything with my local web server my system PEAR::isError($auth) returns TRUE if there is an error.<br /><br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent"><br />print_r from $auth my web hoster (PHP 5.3.10):<br /><br />PEAR_Error Object<br />(<br />    &#91;error_message_prefix&#93; =&gt; <br />    &#91;mode&#93; =&gt; 1<br />    &#91;level&#93; =&gt; 1024<br />    &#91;code&#93; =&gt; <br />    &#91;message&#93; =&gt; REPLAYED_OTP<br />    &#91;userinfo&#93; =&gt; <br />    &#91;backtrace&#93; =&gt; Array<br />        (<br />            &#91;0&#93; =&gt; Array<br />                (<br />                    &#91;file&#93; =&gt; /usr/local/lib/php/PEAR.php<br />                    &#91;line&#93; =&gt; 527<br />                    &#91;function&#93; =&gt; PEAR_Error<br />                    &#91;class&#93; =&gt; PEAR_Error<br />                    &#91;object&#93; =&gt; PEAR_Error Object<br /> *RECURSION*<br />                    &#91;type&#93; =&gt; -&gt;<br />                    &#91;args&#93; =&gt; Array<br />                        (<br />                            &#91;0&#93; =&gt; REPLAYED_OTP<br />                            &#91;1&#93; =&gt; <br />                            &#91;2&#93; =&gt; 1<br />                            &#91;3&#93; =&gt; 1024<br />                            &#91;4&#93; =&gt; <br />                        )<br />&#91;/code&#93;<br /><br /><br />local web server (PHP 5.3.20):<br /><br />&#91;code&#93;<br />PEAR_Error Object<br />(<br />    &#91;error_message_prefix&#93; =&gt; <br />    &#91;mode&#93; =&gt; 1<br />    &#91;level&#93; =&gt; 1024<br />    &#91;code&#93; =&gt; <br />    &#91;message&#93; =&gt; REPLAYED_OTP<br />    &#91;userinfo&#93; =&gt; <br />    &#91;backtrace&#93; =&gt; Array<br />        (<br />            &#91;0&#93; =&gt; Array<br />                (<br />                    &#91;file&#93; =&gt; /Applications/MAMP/bin/php/php5.3.20/lib/php/PEAR.php<br />                    &#91;line&#93; =&gt; 533<br />                    &#91;function&#93; =&gt; PEAR_Error<br />                    &#91;class&#93; =&gt; PEAR_Error<br />                    &#91;type&#93; =&gt; -&gt;<br />                    &#91;args&#93; =&gt; Array<br />                        (<br />                            &#91;0&#93; =&gt; REPLAYED_OTP<br />                            &#91;1&#93; =&gt; <br />                            &#91;2&#93; =&gt; 1<br />                            &#91;3&#93; =&gt; 1024<br />                            &#91;4&#93; =&gt; <br />                        )<br /><br />&#91;/code&#93;<br /><br /><br /><br /><br />It’s no good idea, to trust in PEAR::isError($auth)<br /><br /><br />Now I’m using:<br /><br />&#91;code&#93;<br />$yubi = new Auth_Yubico('42', 'FOOBAR=');<br />$auth = $yubi-&gt;verify($otp);<br />if ($auth !== true) {<br />   print &quot;&lt;p&gt;Authentication failed: &quot; . $auth-&gt;getMessage();<br />   print &quot;&lt;p&gt;Debug output from server: &quot; . $yubi-&gt;getLastResponse();<br />} else {<br />   print &quot;&lt;p&gt;You are authenticated!&quot;;<br />}<br /></div><br /><br />Kind regards<br />Mario<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2466">djm03</a> — Wed Jun 05, 2013 3:17 pm</p><hr />
]]></content>
</entry>
</feed>