Re: Boolean value getting improperly converted to array [Resolved]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Well no one seems to be very active on this list anymore, but since I posted
this and have solved it I thought that I'd post it so maybe somone else will
benefit from my learning.

Anyway the issue with this is that I had created classes for my SOAP objects
in PHP so that I could add functionality instead of just having an object
that consisted of just the values.  In my object I had set some of my
members to default values, this is what was being read by the _decode
function in Base.php, and since there was already a value present it assumed
that this new value was a member of an array.

So moral of th story, if you want to build PHP objects that have extended
functionality from your SOAP objects set all your members default values to
be NULL or you will get strange results from PEAR::SOAP.

Rob

"Rob Booth" <rbooth@indyme.com> wrote in message
20040723031932.27481.qmail@pb1.pair.com">news:20040723031932.27481.qmail@pb1.pair.com...
> I hope someone can help me out with this.  I am sending a object to my
SOAP
> Sever that holds a couple of boolean values.  The object appears correct,
> but one of my boolean values always gets converted by PEAR::SOAP to be an
> array of values.  I've tracked down where this conversion is happening,
it's
> in the _decode function of Base.php.  While looping over the items in my
> object PEAR::SOAP evaluates this line " } else if
> (isset($return->{$item->name})) {" which it ends up evaluating as true for
> this one boolean value.
>
> Here is the item that is being checked by this code:
> array (
>   'value' => 'false',
>   'name' => 'DeleteOldestWhenFull',
>   'type' => 'boolean',
>   'namespace' => 'urn:Voicemail',
>   'type_namespace' => 'http://www.w3.org/2001/XMLSchema',
>   'attributes' =>
>   array (
>   ),
>   'arrayType' => '',
>   'options' =>
>   array (
>   ),
>   'nqn' =>
>   array (
>     'name' => 'DeleteOldestWhenFull',
>     'ns' => '',
>     'namespace' => 'urn:Voicemail',
>   ),
>   'tqn' =>
>   array (
>     'name' => 'boolean',
>     'ns' => '',
>     'namespace' => 'http://www.w3.org/2001/XMLSchema',
>   ),
>   'type_prefix' => '',
> )
>
> As far as I can tell that looks perfect (exactly like another boolean
value
> in the same object, except for it's name).
>
> After the line of evaluation happens my new object looks like this:
> array (
>   'ClassOfServiceID' => 11,
>   'Name' => 'New COS',
>   'Number' => '200',
>   'DefaultPassword' => '4321',
>   'MaxMessageLengthSeconds' => 0,
>   'MessageTimePerMailboxMinutes' => 0,
>   'MaximumNumMessages' => 0,
>   'DeleteOldestWhenFull' =>
>   array (
>     0 => false,
>     1 => false,
>   ),
>   'DirectoryListingEnabled' => false,
>   'ClassOfServiceRightList' => NULL,
> )
>
> Why does DeleteOldestWhenFull convert to an array, when
> DirectoryListingEnabled doesn't?  I can't seem to figure out what exactly
is
> happening here.  Any help would be greatly appreaciated.  I'm using an
older
> version of PEAR::SOAP and am unable to upgrade it, I can however make
> appropriate changes to the version I have if this is a bug that has been
> fixed.
>
> Thanks,
> Rob

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux