Issues

ZF-5949: When connectivity is down, it fails with fatal non-object error

Issue Type: Bug Created: 2009-03-05T05:36:35.000+0000 Last Updated: 2009-04-02T16:09:02.000+0000 Status: Resolved Fix version(s): - 1.8.1 (12/May/09)

Reporter: Peter Kehl (peter.kehl) Assignee: Trevor Johns (tjohns) Tags: - Zend_Gdata

Related issues: Attachments:

Description

In short: If network connectivity is down after you got Zend_Gdata_Gapps service with valid authentication credentials, then the next Google request fails and throws a fatal error rather than a nice Zend exception.

That can happen e.g. in batch processing, when you use Zend_Gdata_Gapps over several actions, and suddenly your comms go down.

How to duplicate the problem: createUser( 'sleepy.smallelephant', 'Small Elephant', 'Sleepy', 'very secret password', null ); ?>

Trace: Fatal error: Call to a member function getBody() on a non-object in /Users/peterk/google.mytbwa.com/trunk/google_gateway/library/Zend/Gdata/Gapps.php on line 151

Call Stack: 0.0051 239216 1. {main}() /Users/peterk/google.mytbwa.com/trunk/google_gateway/action/process.php:0 0.0901 3633944 2. process_action_set_status() /Users/peterk/google.mytbwa.com/trunk/google_gateway/action/process.php:745 0.0901 3634496 3. process_action() /Users/peterk/google.mytbwa.com/trunk/google_gateway/action/process.php:307 10.0916 3643920 4. Zend_Gdata_Gapps->retrieveUser() /Users/peterk/google.mytbwa.com/trunk/google_gateway/action/process.php:427 10.0952 3761512 5. Zend_Gdata_Gapps->getUserEntry() /Users/peterk/google.mytbwa.com/trunk/google_gateway/library/Zend/Gdata/Gapps.php:754 10.0953 3761784 6. Zend_Gdata->getEntry() /Users/peterk/google.mytbwa.com/trunk/google_gateway/library/Zend/Gdata/Gapps.php:465 10.0953 3762072 7. Zend_Gdata_App->getEntry() /Users/peterk/google.mytbwa.com/trunk/google_gateway/library/Zend/Gdata.php:186 10.0953 3762072 8. Zend_Gdata_App->importUrl() /Users/peterk/google.mytbwa.com/trunk/google_gateway/library/Zend/Gdata/App.php:219 10.0953 3763024 9. Zend_Gdata_Gapps->get() /Users/peterk/google.mytbwa.com/trunk/google_gateway/library/Zend/Gdata/App.php:718 10.1105 4222608 10. Zend_Gdata_Gapps::throwServiceExceptionIfDetected() /Users/peterk/google.mytbwa.com/trunk/google_gateway/library/Zend/Gdata/Gapps.php:205

Proposed solution: In library/Zend/Gdata/Gapps.php modify throwServiceExceptionIfDetected($e) to use something like following: $response= $e->getResponse(); if( $response ) { $error = new Zend_Gdata_Gapps_ServiceException(); $error->importFromString( $response->getBody() ); //var_dump(debug_backtrace()); //debug_print_backtrace(); throw $error; } else { throw new Exception( "Google connection is down or some other serious error." ); }

This is in version 1.7.4 but throwServiceExceptionIfDetected() is same in 1.7.6 so most likely there's the same problem in 1.7.6 and the fix should work for 1.7.6 too.

I've signed the contributor's agreement so it's OK for you to use any of the above. Thx

Comments

Posted by Trevor Johns (tjohns) on 2009-03-07T11:38:44.000+0000

Patch sent to [~jhartmann] for review:

http://codereview.appspot.com/24079

Posted by Trevor Johns (tjohns) on 2009-04-02T16:08:49.000+0000

Committed to trunk as r14612. Committed to release-1.7 as r14613. Marking as fixed as of the next mini release.

<pre class="literal">
commit e882d1eb739c7a77dfbaa28bcea7254bae715ef6
Author: tjohns 
Date:   Thu Apr 2 22:52:29 2009 +0000

    ZF-5949: Update Zend_Gdata_Gapps to throw an exception (rather than a fatal
    error) when connectivity is lost.
    
    Review URL: <a href="http://codereview.appspot.com/24079">http://codereview.appspot.com/24079</a>
    
    git-svn-id: <a href="http://framework.zend.com/svn/framework/standard/trunk@14612">http://framework.zend.com/svn/framework/…</a> 44c647ce-9c0f-0410-b52a-842ac1e357ba

commit ac3147eb8d9be1928ffb2bbfb4f1ef3586105cf2
Author: tjohns 
Date:   Thu Apr 2 23:04:12 2009 +0000

    Merging r14612 from trunk to release-1.7.
    
    ZF-5949: Update Zend_Gdata_Gapps to throw an exception (rather than a fatal
    error) when connectivity is lost.
    
    Review URL: <a href="http://codereview.appspot.com/24079">http://codereview.appspot.com/24079</a>
    
    git-svn-id: <a href="http://framework.zend.com/svn/framework/standard/branches/release-1.7@14613">http://framework.zend.com/svn/framework/…</a> 44c647ce-9c0f-0410-b52a-842ac1e357ba

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts