report from @gumdal

I am facing this error, but at a different location. I have just installed Services Views module today, which means that it contains the patch submitted by ygerasimov on November 18, 2012.

This is what I get:
Fatal error: Unsupported operand types in /home/....//sites/all/modules/services/auth/services_oauth/services_oauth.inc on line 25

Thanks for any suggestions / fixes.

Comments

gumdal’s picture

With reference to the post: http://drupal.org/node/1672494

kylebrowning’s picture

Can i get an export of the endpoint?

I cannot seem to reproduce this error.

gumdal’s picture

This is the export of my service endpoint which is created with Services Views. (EDIT:)When I disable OAuth, the webservice gives required output. But when OAuth is enabled I should ideally get "Request must be signed" response when the URL is hit directly, but I get back the Fatal error. Thanks.

$endpoint = new stdClass();
$endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */
$endpoint->api_version = 3;
$endpoint->name = 'snakes_of_india';
$endpoint->server = 'rest_server';
$endpoint->path = 'snakes_of_india';
$endpoint->authentication = array(
  'services_oauth' => 'services_oauth',
);
$endpoint->server_settings = array();
$endpoint->resources = array(
  'listing' => array(
    'operations' => array(
      'index' => array(
        'enabled' => '1',
        'settings' => array(
          'services_oauth' => array(
            'credentials' => '',
            'authorization' => '',
          ),
        ),
      ),
    ),
  ),
);
$endpoint->debug = 0;

This is the export which works, but of course without Consumer Key authentication:

$endpoint = new stdClass();
$endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */
$endpoint->api_version = 3;
$endpoint->name = 'snakes_of_india';
$endpoint->server = 'rest_server';
$endpoint->path = 'snakes_of_india';
$endpoint->authentication = array(
  'services_oauth' => array(
    'oauth_context' => '',
    'credentials' => 'none',
  ),
);
$endpoint->server_settings = array();
$endpoint->resources = array(
  'listing' => array(
    'operations' => array(
      'index' => array(
        'enabled' => '1',
        'settings' => array(
          'services_oauth' => array(
            'credentials' => '',
            'authorization' => '',
          ),
        ),
      ),
    ),
  ),
);
$endpoint->debug = 0;
gumdal’s picture

Extremely sorry, doing everything from scratch started working for me. Apologies for killing your time.

This is the final export:

$endpoint = new stdClass();
$endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */
$endpoint->api_version = 3;
$endpoint->name = 'snakes_of_india';
$endpoint->server = 'rest_server';
$endpoint->path = 'snakes_of_india';
$endpoint->authentication = array(
  'services_oauth' => array(
    'oauth_context' => 'snakes_of_india',
    'credentials' => 'consumer',
  ),
);
$endpoint->server_settings = array();
$endpoint->resources = array(
  'listing' => array(
    'operations' => array(
      'index' => array(
        'enabled' => '1',
        'settings' => array(
          'services_oauth' => array(
            'credentials' => '',
            'authorization' => '',
          ),
        ),
      ),
    ),
  ),
);
$endpoint->debug = 0;

I guess I was missing to mention the type of OAuth method.

kylebrowning’s picture

Yeah im just trying to find the point where it fails since I cannot seem to recreate.

Glad it is working but gonna try and find the fatal error.

kylebrowning’s picture

Status: Active » Closed (cannot reproduce)
baselkhateeb’s picture

Priority: Normal » Critical
Status: Closed (cannot reproduce) » Active

Having the same issue here, and I did recreate everything from the scratch with no luck :(

baselkhateeb’s picture

line 25: $endpoint += $settings;

this line is making this issue.. I tried changing the operand to = instead, it worked but not saving the settings any more!!

marcingy’s picture

Priority: Critical » Normal
marcingy’s picture

Please provide steps to recreate.

marcingy’s picture

Status: Active » Postponed (maintainer needs more info)
snufkin’s picture

Status: Postponed (maintainer needs more info) » Needs work

This happens to me when I'm trying to expose a Views service over OAuth. I followed http://drupal.org/node/1871498 until the OAuth setup and it all worked fine. Then i set the authentication for the service to OAuth (https://www.evernote.com/shard/s136/sh/cdbf4918-5b81-44a3-b794-d8b24c971...). The context selector can't be used and accessing the endpoint (which worked without OAuth) gives me this trace (for the resource (admin/structure/services/list/profiles/resources) the default authentication is set, which is OAuth):

Fatal error: Unsupported operand types in [...]/sites/all/modules/services/auth/services_oauth/services_oauth.inc on line 25
Call Stack
# Time Memory Function Location
1 0.0000 328584 {main}( ) ../index.php:0
2 0.0355 3013552 menu_execute_active_handler( ) ../index.php:21
3 0.0358 3014260 call_user_func_array ( ) ../menu.inc:517
4 0.0358 3014480 services_endpoint_callback( ) ../menu.inc:517
5 0.0465 3690168 call_user_func ( ) ../services.module:204
6 0.0465 3690168 rest_server_server( ) ../services.module:204
7 0.0471 3711012 RESTServer->handle( ) ../rest_server.module:34
8 0.0556 3805720 services_controller_execute( ) ../RESTServer.inc:152
9 0.0577 3807316 services_auth_invoke( ) ../services.runtime.inc:119
10 0.0579 3809332 call_user_func_array ( ) ../services.runtime.inc:249
11 0.0579 3809600 _services_oauth_authenticate_call( ) ../services.runtime.inc:249

I dont have much time to debug at the moment, I hope this gives you a good starting point.

The issue is both with stable and dev.

trimbletodd’s picture

I ran into this issue as well, and it looks like it happens when the $controller['endpoint'] variable doesn't have the 'oauth2_server' key defined.

So I monkey patched it. Not saying it's pretty. But it got me past the problem.

kylebrowning’s picture

I believe i fixed an issue related to this in dev.

Can you verify the dev branch continues with this error?

kylebrowning’s picture

Issue summary: View changes
Status: Needs work » Closed (cannot reproduce)