Using Flash I can connect to D7 using system.connect and get session ID back as expected. But when I click anything within Drupal the next time I get 3 error messages:

•Notice: Undefined index: args in AmfServerServiceProxy->execute() (line 89 of C:\Program Files\xampp\htdocs\drupal-7.0-flash\sites\default\modules\services\servers\amfserver\amfserver.resources.inc).
•Notice: Undefined index: args in AmfServerServiceProxy->execute() (line 99 of C:\Program Files\xampp\htdocs\drupal-7.0-flash\sites\default\modules\services\servers\amfserver\amfserver.resources.inc).
•Warning: Invalid argument supplied for foreach() in AmfServerServiceProxy->execute() (line 99 of C:\Program Files\xampp\htdocs\drupal-7.0-flash\sites\default\modules\services\servers\amfserver\amfserver.resources.inc).

CommentFileSizeAuthor
#3 Error message.JPG102.63 KBBeyersdorferTJ

Comments

marcingy’s picture

Project: Services » amfserver
Version: 7.x-3.0-rc3 » 7.x-3.0-rc1

Moving project given nature of errors.

rolf vreijdenberger’s picture

Hi beyersdoferTJ.
what do you mean by 'when I click anything within drupal'?
Are you doing flash only and can you give a little more context as to when this error happens?
Where do you get the error? It seems like it's html output.
Do you run a flash app inside your drupal html output?
Can you provide a screenshot?
what are the steps to reproduce?
etc.
thanks for pointing it out!

BeyersdorferTJ’s picture

StatusFileSize
new102.63 KB

The Flash app starts from within Drupal and works fine consuming 100% of the screen. However, when I close it and come back to the "normal" Drupal page I get the error messages. As far as I've looked into it the error messages are produced when you use system.connect from Flash. (other don't produce more messages- for example system.get_variable works.)

If I have my Drupal page open and connect from outside with my Flash, than I get exaclty the same error massages as soon as I load any new page within Drupal as attached. If my Flash would connect n times from outside I would get n multipied by 3 error messages. If I reload the same page all the messages are gone (till next system.connect). So it seems to me that the error messages are queued anywhere and the queue is handled when I load a normal page.

rolf vreijdenberger’s picture

Thanks,

on a different note, I don't think that you'd need to use system.connect anymore, since you'll have no need of the session Id since in D7, session handling is fundamentally changed for services and is working differently on a low level actionscript/browser/services implementation.

Could you try doing things without system.connect? My guess is everything would work fine.

the message seems to come from a call to the Zend AMF server handled via the amfserver where no arguments are given. But going throught the stack this seems to be 'not possible'.
I can fix this by checking the 'args' but it should not happen at all. It would greatly help if you check working without system.connect and posting feedback.

BeyersdorferTJ’s picture

Status: Active » Closed (fixed)

It worked fine without system.connect !!! Seems I've used an old docu.

Thanks
:-)

rolf vreijdenberger’s picture

and thank you my friend :-)

giorgio79’s picture

Title: AmfServerServiceProxy->execute() error with system.connect » system.connect works but produces 3 error messages
Version: 7.x-3.0 » 7.x-3.0-rc1
Status: Active » Closed (fixed)

Hello Guys,

I just encountered this issue with system connect:
"Warning: Invalid argument supplied for foreach() in AmfServerServiceProxy->execute() (line 99 of... "

The error does not crash the site though.

system.connect is ideal if I login the user through Drupal, and just get the session with system connect for Flash.

If we should not use it, how could we get the currently logged in user data from the browser easily without having to relogin?

giorgio79’s picture

Title: system.connect works but produces 3 error messages » AmfServerServiceProxy->execute() error with system.connect

More accurate title for searchers
Also, I notice I only get the

Warning: Invalid argument supplied for foreach() in AmfServerServiceProxy->execute() (line 99 of sites/all/modules/amfserver/amfserver.resources.inc).

The undefined args seem to be gone.

giorgio79’s picture

Version: 7.x-3.0-rc1 » 7.x-3.0
Status: Closed (fixed) » Active

Hope you dont mind if I set it back to active. system.connect is essential I believe.

rolf vreijdenberger’s picture

Title: system.connect works but produces 3 error messages » AmfServerServiceProxy->execute() error with system.connect
Version: 7.x-3.0-rc1 » 7.x-3.0
Status: Closed (fixed) » Active

Hi Giorgio,

can you give me a step by step explanation of what you mean?
Is this the same for every browser, I can remember (from way back) that IE reused the session from the browser in flash but not firefox (long time ago with afmphp)?

so like:
1. user visits drupal site without flash
2. user logs in
3. user visits page with flash element.
4. flash element tries system connect?
etc

thanks

giorgio79’s picture

Hey Rolf,

Yes, those are the exact steps. I am using Firefox.

1. user visits drupal site without flash
2. user logs in
3. user visits page with flash element.
4. flash element performs system connect
5. browse to another page, or do a page refresh for the error to appear.

This does not break anything it seems so far but it still shows as a warning.

rolf vreijdenberger’s picture

Giorgio,

I believe the error is because the services module itself does not enforce any argument checking on the passed arguments to a remote method call. Instead, services thinks the responsibility should rest on the server implementation itself

Since the amfserver does handle this (because I saw this as a shortcoming of services) and checks for optional and mandatory arguments, providing sensible defaults, this bug was introduced.

in the services module in system_resource.inc, there is no 'args' defined for system.connect, hence the validation code chocked on system.connect.
I made a fix and will put it in the next release.

thanks for your help

function _system_resource_definition() {
  return array(
    'system' => array(
      'actions' => array(
        'connect' => array(
          'access callback' => 'services_access_menu',
          'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/system_resource'),
          'callback' => '_system_resource_connect',
        ),
        'get_variable' => array(
          'help'   => t('Returns the value of a system variable using variable_get().'),
          'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/system_resource'),
          'callback' => 'variable_get',
          'access arguments' => array('get a system variable'),
          'access arguments append' => FALSE,
          'args' => array(
            array(
              'name' => 'name',
              'optional' => FALSE,
              'source' => 'data',
              'description' => t('The name of the variable to return.'),
              'type' => 'string',
            ),
            array(
              'name' => 'default',
              'optional' => TRUE,
              'source' => 'data',
              'description' => t('The default value to use if this variable has never been set.'),
              'type' => 'string',
            ),
          ),
        ),
        'set_variable' => array(
          'help'   => t('Sets the value of a system variable using variable_set().'),
          'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/system_resource'),
          'callback' => 'variable_set',
          'access arguments' => array('set a system variable'),
          'access arguments append' => FALSE,
          'args' => array(
            array(
              'name' => 'name',
              'optional' => FALSE,
              'source' => 'data',
              'description' => t('The name of the variable to set.'),
              'type' => 'string',
            ),
            array(
              'name' => 'value',
              'optional' => FALSE,
              'source' => 'data',
              'description' => t('The value to set.'),
              'type' => 'string',
            ),
          ),
        ),
        'del_variable' => array(
          'help'   => t('Deletes a system variable using variable_del().'),
          'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/system_resource'),
          'callback' => 'variable_del',
          'access arguments' => array('set a system variable'),
          'access arguments append' => FALSE,
          'args' => array(
            array(
              'name' => 'name',
              'optional' => FALSE,
              'source' => 'data',
              'description' => t('The name of the variable to delete.'),
              'type' => 'string',
            ),
          ),
        ),
      ),
    ),
  );
}
rolf vreijdenberger’s picture

Status: Active » Fixed
giorgio79’s picture

Lovely, appreciated.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.