Issues

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

Description

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/dev.e8.fi/web/lib/Zend/Loader.php:88 Stack trace:

0 /opt/www/sites/dev.e8.fi/web/lib/Zend/Validate/Hostname.php(331): Zend_Loader::loadClass('Zend_Validate_H...')

1 /opt/www/sites/dev.e8.fi/web/lib/Zend/Uri/Http.php(426): Zend_Validate_Hostname->isValid('www.google.com')

2 /opt/www/sites/dev.e8.fi/web/lib/Zend/Uri/Http.php(260): Zend_Uri_Http->validateHost()

3 /opt/www/sites/dev.e8.fi/web/lib/Zend/Uri/Http.php(134): Zend_Uri_Http->valid()

4 /opt/www/sites/dev.e8.fi/web/lib/Zend/Uri.php(123): Zend_Uri_Http->__construct('http', '//www.google.co...')

5 /opt/www/sites/dev.e8.fi/web/lib/Zend/Http/Client.php(257): Zend_Uri::factory('http://www.goog...')

6 /opt/www/sites/dev.e8.fi/web/lib/Zend/Gdata/App.php(476): Zend_Http_Client->setUri('http://www.goog...')

7 /opt/www/sites/dev.e8.fi/web/lib/Zend/Gdata.php(201): Zend_Gdata_App->performHttpRequest('GET', 'http://www.goog...', Array, NULL, NULL, NULL)

8 /opt/www/sites/dev.e8.fi/web/lib/Zend/Gdata/App.php(610): Zend_Gdata->performHttpRequest('GET', 'http://www.goog...')

9 /opt/www/sites/dev.e8.fi/web/lib/Zend/Gdata/App.php(541): Zend_Gdata_App->get('http://www.goog...')

10 /opt/www/sites/dev.e8.fi/web/lib/Zend/Gdata/App.php(147): Zend_Gdata_App->importUrl('http://www.goog...', 'Zend_Gdata_Feed')

11 /opt/www/sites/dev.e8.fi/web/lib/Zend/Gdata.php(148): Zend_Gdata_App->getFeed('http://www.goog...', 'Zend_Gdata_Feed')

12 /opt/www/sites/dev.e8.fi/web/application/controllers/ImportController.php(208): Zend_Gdata->getFeed(Object(Zend_Gdata_Query))

13 /opt/www/sites/dev.e8.fi/web/lib/Zend/Controller/Action.php(494): ImportController->gmailAction()

14 /opt/www/sites/dev.e8.fi/web/lib/Zend/Controller/Dispatcher/Standard.php(285): Zend_Controller_Action->dispatch('gmailAction')

15 /opt/www/sites/dev.e8.fi/web/lib/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))

16 /opt/www/sites/dev.e8.fi/web/html/index.php(314): 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?

Comments

Do you have any custom error handling turned on? http://framework.zend.com/issues/browse/ZF-3989

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: http://nabble.com/Zend_Validate_Hostname-trying-to… " 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: http://us.php.net/operators.errorcontrol

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.