ZF-5024: Symlink function fail causes Zend_OpenId_Consumer to fail

Issue Type: Bug Created: 2008-11-21T16:15:42.000+0000 Last Updated: 2012-06-11T11:52:31.000+0000 Status: Reopened Fix version(s): - 1.7.1 (01/Dec/08)

Reporter: R Slootjes (rslootjes) Assignee: Dmitry Stogov (dmitry) Tags: - Zend_OpenId

  • FixForZF1.12

Related issues: Attachments: - File.php.patch


This really took me hours to figure out. I tried to verify myself with OpenId and it was working fine on server A but not on server B while the script is the same, including PHP version (5.2.6). I debugged my *ss of to find out why the verify function was failing me and it all came down to 1 small function: symlink.

This is the piece of code in Zend_OpenId_Consumer_Storage_File in the function addAssociation:

<pre class="literal"> 
if (function_exists('symlink')) {
    symlink($name1, $name2);
} else {
    $f2 = @fopen($name2, 'w+');
    if ($f2) {
        fwrite($f2, $data);

The symlink function does exist but it returns false and thus the assoc_handle_{hash} file isnt written to the filesystem which causes the getAssociationByHandle function to fail during the verification process. After removing the symlink part (so it would always use the fopen/frwite/fclose functions) everything was working like a charm. So, maybe its a good thing to add an extra check if the symlink function really worked.


Posted by Dmitry Stogov (dmitry) on 2008-12-01T02:27:22.000+0000

What operating system do you use?

Posted by R Slootjes (rslootjes) on 2008-12-01T03:57:32.000+0000

Im running CentOS5 with PHP5.2.6

Maybe important to know: im running suPHP and I've patched PHP with the wellknown Suhosin patch.

Posted by Tomáš Fejfar ( on 2012-05-10T19:31:27.000+0000

Same problem occurs on Windows (PHP 5.3.8 (cli) (built: Aug 23 2011 11:50:20)), because you need superuser priviledges to create symlinks.

Removing the symlink part fixes it for me. It looks like the symlink is only improvement, not requirement. I suggest removing it. It's not fatal error, but it emits a warning



Posted by Tomáš Fejfar ( on 2012-05-10T19:31:56.000+0000

Patch that removes the symlink logic from storage class



Posted by Rob Allen (rob) on 2012-05-17T21:08:39.000+0000

Applying patch causes unit test failures:

    <pre class="highlight">
    1) Zend_OpenId_ConsumerTest::testGetAssociation
    Failed asserting that  is true.
    2) Zend_OpenId_ConsumerTest::testAssociate
    Failed asserting that  is true.
    3) Zend_OpenId_ConsumerTest::testVerifyDumb
    Failed asserting that  is false.
    4) Zend_OpenId_Consumer_Storage_FileTest::testGetAssociation
    Failed asserting that  is true.
    5) Zend_OpenId_Consumer_Storage_FileTest::testGetAssociationByHandle
    Failed asserting that  is true.
    Tests: 54, Assertions: 796, Failures: 5, Errors: 2.



Posted by Tomáš Fejfar ( on 2012-05-19T11:39:51.000+0000

I'll try to look at it and compare OSX vs. Win but I'm not sure it will be ready for 1.12. as I'm pretty busy now :(



Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.