ZF-7506: exception 'Zend_Exception' with message 'File "Zend/Validate/Hostname/Com.php" does not exist or class "Zend_Validate_Hostname_Com" was not found


I'm getting the following exception:

exception 'Zend_Exception' with message 'File "Zend/Validate/Hostname/Com.php" does not exist or class "Zend_Validate_Hostname_Com" was not found in the file' in /opt/www/sites/ Stack trace:

0 /opt/www/sites/ Zend_Loader::loadClass('Zend_Validate_H...')

1 /opt/www/sites/ Zend_Validate_Hostname->isValid('')

2 /opt/www/sites/ Zend_Uri_Http->validateHost()

3 /opt/www/sites/ Zend_Uri_Http->valid()

4 /opt/www/sites/ Zend_Uri_Http->__construct('http', '//')

5 /opt/www/sites/ Zend_Uri::factory('')

6 /opt/www/sites/ Zend_Http_Client->setUri('')

7 /opt/www/sites/ Zend_Gdata_App->performHttpRequest('GET', '', Array, NULL, NULL, NULL)

8 /opt/www/sites/ Zend_Gdata->performHttpRequest('GET', '')

9 /opt/www/sites/ Zend_Gdata_App->get('')

10 /opt/www/sites/ Zend_Gdata_App->importUrl('', 'Zend_Gdata_Feed')

11 /opt/www/sites/ Zend_Gdata_App->getFeed('', 'Zend_Gdata_Feed')

12 /opt/www/sites/ Zend_Gdata->getFeed(Object(Zend_Gdata_Query))

13 /opt/www/sites/ ImportController->gmailAction()

14 /opt/www/sites/ Zend_Controller_Action->dispatch('gmailAction')

15 /opt/www/sites/ Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))

16 /opt/www/sites/ Zend_Controller_Front->dispatch()

17 {main}

The problem is that it does not make any sense. I'm using Zend_Gdata and seems that Zend_Gdata is causing the bug.

Does anybody know how can I avoid this exception?


Do you have any custom error handling turned on?

Sometimes other frameworks configure custom error handling.. QCodo had that issue before for someone on the zf-gdata list. Here was my response back then:… " Hi Nico,

Okay, I've looked into this a bit further.

It looks like something in your code is overriding the error handling, so even though Zend/Loader.php:160 is intentionally suppressing any errors that occur, the code is ignoring that suppression.

What's happening here: The Zend_Validate_Hostname code is capable of having per-top-level-domain validation. It looks like this is primarily intended for international domain names, so there is no separate logic for '.com' extensions. The Zend_Validate_Hostname code is checking to see whether a file with the name Zend/Validate/Hostname/Com.php is readable by calling Zend_Loader::isReadable($filename), which is in turn checking whether fopen succeeds. For a vanilla PHP script/install, this will return false and move forward with execution because the '@' suppresses any errors from occurring. However, something in your script is actually overriding the error handling and causing that error to be thrown -- even though the suppression operator was used.

This PHP manual page has more information on error suppression:

Cheers, -Ryan "

Note that this error of Zend_Validate_Hostname has been solved several months ago by me. We are at ZF 1.9.0 !!

Issue fixed since 1.8.0.