showcio / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
0 stars 0 forks source link

PHP Fatal error: Class name must be a valid object or a string #339

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We are using 0.6.2 and get the following error:

PHP Fatal error:  Class name must be a valid object or a string in 
[removed]/vendor/google-api/Google_Client.php on line 108

This code was working, but recently stopped.  I agree it's from a change on our 
end, however, I wanted to know if you had any ideas what could be causing it.  
This problem only occurs in our production environment, our dev and test envs 
work fine.

Ideas?  Thanks for your help.

Original issue reported on code.google.com by dsh...@weebly.com on 25 Jun 2013 at 5:46

GoogleCodeExporter commented 8 years ago
That line is where it loads the cache class. Check the config does not have an 
error or missing value.

Original comment by ianbar...@google.com on 27 Jun 2013 at 3:27

GoogleCodeExporter commented 8 years ago
It looks like a problem with the APC cache (or how we us it).  The following 
change fixed it:

--- a/vendor/google-api/Google_Client.php
+++ b/vendor/google-api/Google_Client.php
@@ -36,7 +36,7 @@ if (! ini_get('date.timezone') && 
function_exists('date_default_timezone_set'))
 // hack around with the include paths a bit so the library 'just works'
 set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());

-require_once "config.php";
+require_once __DIR__ . "/config.php";
 // If a local configuration file is found, merge it's values with the default configuration
 if (file_exists(dirname(__FILE__)  . '/local_config.php')) {
   $defaultConfig = $apiConfig;

Original comment by dsh...@weebly.com on 27 Jun 2013 at 4:22

GoogleCodeExporter commented 8 years ago
I have same issue ,  I am trying to configure google-api code with codeigniter 
library facing same problem with config.php  

Original comment by svajma...@gmail.com on 10 Jul 2013 at 11:38

GoogleCodeExporter commented 8 years ago
I think there's a typo error in APC cache class

class googleApcCache extends Google_Cache {

shoulb be

class Google_ApcCache extends Google_Cache {

isn't it?

Original comment by marc...@gmail.com on 20 Aug 2013 at 8:43

GoogleCodeExporter commented 8 years ago
Also src/cache/Google_Cache.php miss this line:
require_once "Google_ApcCache.php";

Original comment by marc...@gmail.com on 20 Aug 2013 at 8:47

GoogleCodeExporter commented 8 years ago
I had a user report this issue to me in their Moodle site. I see that the issue 
was closed but was wondering if there were any plans to fix this upstream. The 
patch provided adding __DIR__ to the require_once seemed to resolve the issue 
for me. I did not make the other changes suggested in #4 and #5 (just #2). I 
have created https://tracker.moodle.org/browse/MDL-42186 for those who might 
experience this issue when using Moodle. Peace - Anthony 

Original comment by abor...@iccabq.org on 7 Oct 2013 at 4:40

GoogleCodeExporter commented 8 years ago
Just a follow up to let folks know that Moodle 2.5.x is using version 0.6.0 

Original comment by abor...@iccabq.org on 9 Oct 2013 at 9:36