Menu

#8 xmlrpcval with array and struct

open
nobody
None
5
2019-05-21
2012-02-21
Anonymous
No

Hi,
when i create a simple xmlrpcval, everything is fine but when i try to create a "complex" xmlrpcval,
I get this error message :
Notice: Undefined offset: 0 in /var/www/classic/xmlrpc.inc on line 3017
Fatal error: Call to a member function serialize() on a non-object in /var/www/classic/xmlrpc.inc on line 3017

Actually i get this when i try to add an array element. when i replace may array element by a struct it works.
i read your documentation, but i don't know where i'm wrong.
you can see a part of my code in the attached file.

Thank you for your help

Jeff

Discussion

  • Nobody/Anonymous

     
  • Gaetano Giunta

    Gaetano Giunta - 2012-02-22

    I think the problem comes from the fact that, to build an xmlrpc array value, the library expects to get a php array that is not a hash, but is indexed starting from 0.
    In your code, you should change the "subscribers" structure to something like this:

                        'subscribers' => new xmlrpcval(
                            array(
                                new xmlrpcval($user,'string'),
                                new xmlrpcval($domaine,'string'),
                                new xmlrpcval($pass, 'string')
                            ),
                            'array'
    

    Either that, or you should patch the xmlrpcval::serializedata function, to use a foreach() loop instead of a for() one, around line 3017...

     
  • Nobody/Anonymous

    I see... I will try it.
    Thanks a lot.

     

Anonymous
Anonymous

Add attachments
Cancel