ZF-3829: Loader problem GData

Description

Hi,

As soon as I call

Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service);

I start getting the following errors in my log.

\ZendFramework-1.6RC1\library\Zend\Loader.php:160 fopen(Zend/Validate/Hostname/Com.php) [function.fopen]: failed to open stream: No such file or directory (2)

\ZendFramework-1.6RC1\library\Zend\Loader.php:83 Zend_Loader::include_once(Zend\Gdata\Calendar\Extension\EventEntry.php) [zend-loader.include-once]: failed to open stream: No such file or directory (2)

\ZendFramework-1.6RC1\library\Zend\Loader.php:83 Zend_Loader::include_once() [function.include]: Failed opening 'Zend\Gdata\Calendar\Extension\EventEntry.php' for inclusion (include_path='C:\Program Files\Apache Software

I'm trying to create a test appointment within Google Calendar. Here's the code I used below.

$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;

$_client = null;

$_client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service);

if($_client == null) { debugLog("ClientLogin Failed"); } else { debugLog("ClientLogin O.K."); } // Create an instance of the Calendar service $_service1 = new Zend_Gdata_Calendar($_client); if($_service1 == null) { debugLog("Service Failed"); } else { debugLog("Service O.K."); } // Create a new entry using the calendar service's magic factory method $event= $_service1->newEventEntry(); etc........

The same thing happens with 1.5.3 including with the stand alone 1.5.3 GData version.

thanks Nick.

********************Just an update as of 08/08/08***********************

I can't see a way of responding to or closing the issue, even when logged in there is no reply or response option to reply from. Thanks Ryan for the response, Yes I'm using a custom error tracking function but the errorno returned to the function is not zero it's 2 which is E_WARNING. I can just tell my error tracking function to ignore E_WARNINGS then it does not fill my error log with ZendLoader Warnings.

thanks Nick.

*******************Another Update as of 08/08/08*********************** I underdstand what you are saying about the error value you don't mean $errno being zero you mean error_reporting() returning zero. Yes that work's for me. Now how do I close the issue?. I have tried to email Ryan but my email bounces back.

thanks Nick.

Comments

Hi Nick,

It looks like your app may be overriding the error handler in PHP. Anytime Zend_Gdata makes a HTTP connection, in validates the Uri using the Zend_Validate. Zend_Validate looks for a file by the same name as the suffix of the URL, which is nearly always .com when using Google Data APIs. This method uses fopen, but uses the error suppresion operator '@' in order to prevent any errors from being called: http://us2.php.net/operators.errorcontrol

However, if a custom error handler is set, using set_error_handler, that error handler will be called even if the error suppression operator '@' is used: http://us2.php.net/manual/en/…

The custom error handler would need to check the value of error_reporting -- and handle the error differently if the value is 0 (indicating that the offending statement was prepended with a '@')

Please close out the bug if this information resolves the issue for you.

Cheers, -Ryan

I'll close this since the reporter Jochen doesn't seem to be able to do so.

This is related to ZF-2900 which is the same underlying problem. Custom error handlers displaying errors for supressed errors.

Jochen, you are quite right to check error_reporting() for the zero value.

I've been looking into ZF-2900 which is related.

The underlying problem is that if a custom error handler is used then this will always receive errors, even when they are suppressed. The solution is to update the code in Zend_Session_Exception::handleSessionStartError as so:


    static public function handleSessionStartError($errno, $errstr, $errfile, $errline, $errcontext)
    {
        // Do not throw an exception if this is a suppressed error - see ZF-3829
        if (error_reporting() === 0) {
                return;
        }
        self::$sessionStartError = $errfile . '(Line:' . $errline . '): Error #' . $errno . ' ' . $errstr . ' ' . $errcontext;
    }

I can make this change myself if given SVN commit rights to the Zend/Session folder

best wishes, Simon

Please ignore my last comment, I have too many tabs open and I've added this comment to the wrong place, sorry!

For reference that comment was applicable to ZF-3020