Search the web
Sign In
New User? Sign Up
zf-tool · ZFTool
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
The "Cannot redeclare class Zend_OpenId_Provider" problem   Message List  
Reply | Forward Message #49 of 73 |
Re: The "Cannot redeclare class Zend_OpenId_Provider" problem

I ran into a not-entirely unrelated issue that was caused by using a symbolic link to make the Zend and ZendL directories includable. This caused even the zf show version command to fail with the following error since the recursive scan found nothing:

Action 'show' is not a valid action.

I did a search through the ZendL/Tool code and the only reference to symbolic links that I could find was in Tool/Rpc/Loader/IncludePathLoader.php in the _getFiles() call:

            foreach ($iterator as $item) {
                if (!$item->isLink()) {
                    $files[] = $item->getRealPath();
                }
            }

I tried commenting out the isLink() check, but that just gave me errors:

~/bin $ zf show version
PHP Warning:  ZendL_Tool_Rpc_Loader_Abstract::require_once(/home/davew/zf/ZendFramework-1.6.1/library/Zend): failed to open stream: No such file or directory in /home/davew/zf/Zend_Tool/library/ZendL/Tool/Rpc/Loader/Abstract.php on line 18

Warning: ZendL_Tool_Rpc_Loader_Abstract::require_once(/home/davew/zf/ZendFramework-1.6.1/library/Zend): failed to open stream: No such file or directory in /home/davew/zf/Zend_Tool/library/ZendL/Tool/Rpc/Loader/Abstract.php on line 18
PHP Fatal error:  ZendL_Tool_Rpc_Loader_Abstract::require_once(): Failed openingrequired '/home/davew/zf/ZendFramework-1.6.1/library/Zend' (include_path='.:/usr/share/pear:/usr/share/php:/var/www/html/Common/inc') in /home/davew/zf/Zend_Tool/library/ZendL/Tool/Rpc/Loader/Abstract.php on line 18

Fatal error: ZendL_Tool_Rpc_Loader_Abstract::require_once(): Failed opening required '/home/davew/zf/ZendFramework-1.6.1/library/Zend' (include_path='.:/usr/share/pear:/usr/share/php:/var/www/html/Common/inc') in /home/davew/zf/Zend_Tool/library/ZendL/Tool/Rpc/Loader/Abstract.php on line 18

To avoid repetition, please see my comments on the Using Zend_Tool to start up your ZF Project devzone article for details on my PHP/directory setup.

For now it's not a big deal as I've just moved the Zend and ZendL directories into my include_path instead of linking them in and everything is working, but it might be useful for testing new framework versions if you could use links.

Dave Walter

--- In zf-tool@yahoogroups.com, "Tim Fountain" <lists@...> wrote:
>
> I saw a post or two on zf-general about this issue, and since I had (and
> managed to solve) it myself, I thought I'd explain what I believe is causing
> it.
>
> From looking through the code, it appears that Zend_Tool recursively scans
> through all files and directories in your include_path in order to try and
> try and find classes which implement either
> ZendL_Tool_Rpc_Manifest_Interface or ZendL_Tool_Rpc_Provider_Interface. I'm
> guessing the idea is you can have non-ZF code installed to a directory in
> your include path that will automatically add functionality to your ZF CLI
> tool without requiring any setup or configuration by you. E.g. I could go
> and install a PEAR library which would then magically give me access to some
> new zf CLI commands.
>
> The issue occurs if you have a copy of zend framework itself within your
> default include_path, but you've setup Zend_Tool to use a _different_ copy
> of ZF (using either the ZF_PATH env variable or the zf.php file). Zend_Tool
> adds the ZF path you've given it to the include path, and then scans through
> looking for files that end with '(Tool|Manifest|Provider).php'. The
> Zend_OpenId_Provider class matches this, so Zend_Tool includes it and then
> ignores it since it doesn't implement either of the interfaces. But then
> when it finds the same file in your other copy of zend framework, the script
> dies with a fatal error since it's including a file which defines a class
> that already exists.
>
> This might sound like a fairly rare combination of events. The reason I had
> this particular problem is that I'd checked out a copy of ZF from SVN in
> order to play with Zend_Tool, but I also already had the Ubuntu
> zend-framework package installed, and this sits by default in
> /usr/share/php/libzend-framework-php. I guess this problem will eventually
> solve itself when Zend_Tool is out of the incubator, since users who've
> installed ZF to their include_path will have no reason to grab a more recent
> copy of it in order to use Zend_Tool.
>
> However, while it's a cool idea, I'm not completely convinced that scanning
> through the include_path and including files based on name alone is a good
> long term approach. Although quite unlikely, it's theoretically possible
> that two different libraries might declare a class with the same name in
> files that matched the regexp pattern, which would cause the same fatal
> error.
>
> Anyway, for me the solution was simple - I uninstalled the Ubuntu zend
> framework package, since I don't really need it there. So if anyone else has
> this issue check the directories in your include path for copies of ZF, or
> files matching the naming scheme above.
>
> --
> Tim Fountain
> http://www.tfountain.co.uk/
>


Wed Sep 24, 2008 5:30 am

dave_walter
Online Now Online Now
Send Email Send Email

Forward
Message #49 of 73 |
Expand Messages Author Sort by Date

I saw a post or two on zf-general about this issue, and since I had (and managed to solve) it myself, I thought I'd explain what I believe is causing it. From...
Tim Fountain
tfountainzf
Offline Send Email
Sep 11, 2008
8:36 pm

Hey Tim, this is a great email, and I am still digesting. I¹ll respond when I have all my thoughts together. Cheers, Ralph ... -- Ralph Schindler Software...
Ralph Schindler
ralphschindler
Offline Send Email
Sep 15, 2008
6:11 am

I ran into a not-entirely unrelated issue that was caused by using a symbolic link to make the Zend and ZendL directories includable. This caused even the zf...
dave_walter
Online Now Send Email
Sep 24, 2008
5:30 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help