Go Back   ZeroC Forums > Bug Reports

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-27-2004
damingyipai damingyipai is offline
Registered User
 
 
Join Date: Jan 2004
Posts: 59
Unhappy bug when pass a class by value

slice:

class item;

sequence<item> items;
class item
{
string title;
items children;
};

...
item getitem();
...

server side implement code:

itemPtr getitem()
{
itemPtr i = new item;
i->title = "root";

itemPtr i2 = new item;
i2->title = "sub1";
i->children.push_back( i2 );

itemPtr i3 = new item;
i3->title = "sub2";
i2->children.push_back( i3 );

return i;
}


and PHP client side code:

$nav = $obj->getitem();

function dump_nav( $mynav, $level )
{
for ( $j = 0; $j != $level; ++ $j ) {
echo " ";
}
echo $mynav->title;
echo "<br/>";

$child_count = count($mynav->children);
for ( $i = 0; $i != $child_count; ++ $i ) {
ftr_dump_nav( $mynav->children[ i ], level + 1 );
}
}

dump_nav( $nav, 0 );

PHP client result:

"root
"

the well result is:

"root
sub1
sub2"

help me, please.
Reply With Quote
  #2 (permalink)  
Old 03-27-2004
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 962
If you execute the following statement, you'll see that the object graph is being preserved correctly in PHP:
Code:
print_r($nav);
There is a bug in your code which is preventing it from displaying the graph. The corrected line is shown below:
Code:
ftr_dump_nav( $mynav->children[ $i ], $level + 1 );
Take care,
- Mark
Reply With Quote
  #3 (permalink)  
Old 04-02-2004
damingyipai damingyipai is offline
Registered User
 
 
Join Date: Jan 2004
Posts: 59
I see, sorry for my harum-scarum

:-)
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass binary char array to remote host efficiatively? socketref Help Center 7 09-18-2005 10:15 AM
How to pass complex C++ containers in ICE? jvme Help Center 1 08-04-2005 05:30 PM
Why the Chinese character pass between application write with C++ and C# has question lotusqin Help Center 2 05-24-2005 08:46 PM
how to pass/receive value which I dont know at compilation time kovacm Help Center 2 05-10-2005 05:35 PM
Semantics of pass by value for interface chaukmean Help Center 2 11-27-2003 05:21 AM


All times are GMT -4. The time now is 10:38 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.