473,473 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PHP5 and arrays of complextype

Hi,

I am currently having the exact same problem as described here:

http://bugs.php.net/bug.php?id=36226

The webservice is configured to return 0-* objects of a complextype,
but when only one single item is returned, it does not get deserialized
as an array as I would expect, but as a single object.

The new feature proposed on the bottom of the above page does not seem
to be included in our installed version of PHP 5.1.2-1.

Is there any other way to change this behaviour.

Kind regards.

Jan 11 '07 #1
3 1519

"Gerry Vandermaesen" <ge****************@gmail.comwrote in message
news:11**********************@i56g2000hsf.googlegr oups.com...
| Hi,
|
| I am currently having the exact same problem as described here:
|
| http://bugs.php.net/bug.php?id=36226
|
| The webservice is configured to return 0-* objects of a complextype,
| but when only one single item is returned, it does not get deserialized
| as an array as I would expect, but as a single object.
|
| The new feature proposed on the bottom of the above page does not seem
| to be included in our installed version of PHP 5.1.2-1.
|
| Is there any other way to change this behaviour.
|
| Kind regards.

$complexType = yourCallToWebService;
if (!is_array($complexType)){ $complexType = array($complexType); }

perhaps? haven't played with that too much.
Jan 11 '07 #2
Steve wrote:
"Gerry Vandermaesen" <ge****************@gmail.comwrote in message
news:11**********************@i56g2000hsf.googlegr oups.com...
| Hi,
|
| I am currently having the exact same problem as described here:
|
| http://bugs.php.net/bug.php?id=36226
|
| The webservice is configured to return 0-* objects of a complextype,
| but when only one single item is returned, it does not get deserialized
| as an array as I would expect, but as a single object.
|
| The new feature proposed on the bottom of the above page does not seem
| to be included in our installed version of PHP 5.1.2-1.
|
| Is there any other way to change this behaviour.
|
| Kind regards.

$complexType = yourCallToWebService;
if (!is_array($complexType)){ $complexType = array($complexType); }

perhaps? haven't played with that too much.

Because it is an array of arrays, simply checking is_array will always
return true.
Now assuming that the second array is associated array as described in
the bugs,
the following code **might** do the trick

$complexType = yourCallToWebService;
if(array_key_exist('id', $complexType)) $complexType = array($complexType);

Hendri Kurniawan
Jan 11 '07 #3

"Hendri Kurniawan" <as****@email.comwrote in message
news:12*************@corp.supernews.com...
| Steve wrote:
| "Gerry Vandermaesen" <ge****************@gmail.comwrote in message
| news:11**********************@i56g2000hsf.googlegr oups.com...
| | Hi,
| |
| | I am currently having the exact same problem as described here:
| |
| | http://bugs.php.net/bug.php?id=36226
| |
| | The webservice is configured to return 0-* objects of a complextype,
| | but when only one single item is returned, it does not get
deserialized
| | as an array as I would expect, but as a single object.
| |
| | The new feature proposed on the bottom of the above page does not seem
| | to be included in our installed version of PHP 5.1.2-1.
| |
| | Is there any other way to change this behaviour.
| |
| | Kind regards.
| >
| $complexType = yourCallToWebService;
| if (!is_array($complexType)){ $complexType = array($complexType); }
| >
| perhaps? haven't played with that too much.
| >
| >
|
| Because it is an array of arrays, simply checking is_array will always
| return true.

interesting. i had thought that if $complexType was nothing (an unitialized
array for instance), that declaring an array initialized with nothing
(uninitialized array - $complexType) would make the array be likewise
uninitialized. i'll have to check that...just hadn't run across that before.
thanks for the heads-up.

Jan 12 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Terje Slettebø | last post by:
To round off my trilogy of "why"'s about PHP... :) If this subject have been discussed before, I'd appreciate a pointer to it. I again haven't found it in a search of the PHP groups. The PHP...
0
by: Ville Mattila | last post by:
Hello readers, I'm having problems with arrays in SOAP requests. The WSDL definition below does not seem to work, i.e. the ContactList object is not accessible in VB.NET. Contact object works...
0
by: John Harvey | last post by:
I have been struggling with the following: I want to create a class that contains an array of some user-defined type. so I have the following vb code: Public Class Communications Public...
1
by: Istvan | last post by:
Hi ! Can somebody tell me if it's possible to overwrite an element definition when I derive an complexType (with extension, or something like this ) ? The base complexType looks like: ...
0
by: dchappelle | last post by:
Hi, I used wsdl.exe to generate a C# client proxy - included is a piece of the wsdl file of interest... <complexType name="GetSubscriberListEntry"> <sequence> <element name="ServiceId"...
2
by: Summercool | last post by:
I wonder in PHP5, can we use $array1 = $array2 as if it is a class? i think right now, the whole array is copied (by key and value)... and i want to assign by reference but NOT in the alias...
30
by: Logos | last post by:
I have what may be a bug, or may be a misunderstanding on how pass by reference and class inheritance works in PHP. Since I'm relatively new to PHP, I'm hoping for a little outside help to shed...
0
by: vpal61 | last post by:
Hello, I have an Excel/VBA web service client with SOAP Toolkit, consuming Apache Tomcat webservice, which is working fine. Now I am trying to migrate to .NET, and build client in VS2005 with...
14
by: Jeff | last post by:
I'm working on a server that is running PHP4. I'd like to upgrade this so I can use the PHP5 code I have already. What kind, if any, problems will I have with the existing PHP code base? I...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.