ZF-7761: "Zend_Validate_Hostname_Com" was not found using Zend_Service_Twitter
Description
Just only used :
require_once 'Zend/Service/Twitter.php';
$twitter = new Zend_Service_Twitter('username', 'pasword');
I'm using 1.9 zend version and Zend/Validate/Hostname/Com.php exists
What could it be?
I just deleted previous versions and uploaded 1.9 version to library folder
Thanks a lot
Comments
Posted by Thomas Weidner (thomas) on 2009-09-02T11:02:26.000+0000
Autoloading enabled ? Zend_Loader ? PHP Release ?
Posted by Santi (srolivella) on 2009-09-02T11:23:07.000+0000
PHP Version 5.1.6 Not using zend_loader not using autoloading
require_once don't load the class?
thanks
Posted by Thomas Weidner (thomas) on 2009-09-02T11:39:41.000+0000
There is no "require_once" for this file. It is included within Zend_Validate_Hostname by calling "include $filename". And as it's a ressource file there is no class to load.
There are several possibilities to get this error in my opinion: * Manual loading of this ressource file * Probably using autoloader (expectation) * Partitial release (missing files) * Release prior 1.8 (no com detection supported)
Posted by Santi (srolivella) on 2009-09-02T11:54:34.000+0000
I meant I did "require_once 'Zend/Service/Twitter.php'; " nothing about loading com.php,
Should i do it? If I should how can I do it? I understand that it should be including Zend_Validate_Hostname?
I'm not using manual loading of any other file than Zend_Service_Twitter Not using autoloader
thanks
Posted by Thomas Weidner (thomas) on 2009-09-02T12:13:29.000+0000
I still expect that autoloader is somehow active...
Try this simple line:
This is the line which is run by Zend_Validate_Hostname to include the ressource file, and this is the line where you said that the exception is returned.
Also to mention... it would be nice to get the complete exception stack and not only the message.
Posted by Santi (srolivella) on 2009-09-02T12:16:54.000+0000
I'll try what you say
the full message:
Fatal error: Uncaught exception 'Zend_Exception' with message 'File "Zend/Validate/Hostname/Com.php" was loaded but class "Zend_Validate_Hostname_Com" was not found in the file' in /usr/share/ZendGdata/library/Zend/Loader.php:88 Stack trace: #0 /usr/share/ZendGdata/library/Zend/Validate/Hostname.php(331): Zend_Loader::loadClass('Zend_Validate_H...') #1 /usr/share/ZendGdata/library/Zend/Uri/Http.php(354): Zend_Validate_Hostname->isValid('twitter.com') #2 /usr/share/ZendGdata/library/Zend/Uri/Http.php(185): Zend_Uri_Http->validateHost() #3 /usr/share/ZendGdata/library/Zend/Uri/Http.php(96): Zend_Uri_Http->valid() #4 /usr/share/ZendGdata/library/Zend/Uri.php(117): Zend_Uri_Http->__construct('http', '//twitter.com') #5 /home/clientes/solobasket/library/Zend/Rest/Client.php(78): Zend_Uri::factory('http://twitter....') #6 /home/clientes/solobasket/library/Zend/Service/Twitter.php(102): Zend_Rest_Client->setUri('http://twitter....') #7 /home/clientes/solobasket/application/controllers/TwitterController.php(42): Zend_Service_Twit in /usr/share/ZendGdata/library/Zend/Loader.php on line 88
thanks
Posted by Santi (srolivella) on 2009-09-03T02:48:38.000+0000
Thomas i tried your code and it let me see the dump of the file perfectly
Is it meaning I have actived autoloader?
Thanks again
Posted by Thomas Weidner (thomas) on 2009-09-03T07:57:43.000+0000
I think that you are not using 1.9.2
I just checked the code line which is thrown as exception content...
Line 331 within Zend_Validate_Hostname as mentioned in your provided exception text:
0 /usr/share/ZendGdata/library/Zend/Validate/Hostname.php(331): Zend_Loader::loadClass('Zend_Validate_H...')
its a API comment line within 1.9.2. There is no "loadClass" call at all. So my first expectation, that you are not using ZF 1.9.2, is correct.
Check your installation and update the old components and it will work.
Posted by Santi (srolivella) on 2009-09-04T04:49:52.000+0000
Thanks Thomas, i was sure about using 1.9.2 but it's true that I was mixing components maybe an error uploading all the new version
Thanks again, and sorry about my error
Santi