Archived

This forum has been archived. Please start a new discussion on GitHub.

much like a Bug !

much like a Bug !

Slice:

module jf
{
module nation
{
struct UserMessage
{
string User;
string Pwd;
string Group;
string Session;
};

struct UserConn
{
long Id;
};

class Ftr
{
UserConn Good( int encoding, string usr, string pwd, string grp, string sn );
UserConn Bad( int encoding, UserMessage user );
};
};
};


Server side implement:

::jf::nation::UserConn FtrI::Good(
::Ice::Int encoding,
const ::std::string &usr,
const ::std::string &pwd,
const ::std::string &grp,
const ::std::string &sn,
const ::Ice::Current&)
{
::jf::nation::UserConn cn;
cn.Id = 0;
return cn;
}

::jf::nation::UserConn FtrI::Bad(
::Ice::Int encoding,
const ::jf::nation::UserMessage& usr
const ::Ice::Current&)
{
::jf::nation::UserConn cn;
cn.Id = 0;
return cn;
}

Php test code:

<?php
Ice_loadProfile();

try {

$ftr = $ICE->stringToProxy( "FTR:tcp -p 50000" );
$ftr = $ftr->ice_checkedCast( "::jf::nation::FTR" );

} catch( Ice_LocalException $ex ) {
print_r( $ex );
return;
}

try {

echo "this test will be passed...<br/>";
$cn = $ftr->Good( jf_gEncodingPhp, "", "", "", "" );

echo "this test will be failed...<br/>";
$um = new jf_nation_UserMessage;
$cn = $ftr->Bad( jf_gEncodingPhp, $um );

echo "test ok<br/>";
} catch( Ice_LocalException $ex ) {
print_r( $ex );
return;
} catch( jf_GenericError $ex ) {
print_r( $ex->reason );
return;
}
?>

run the test, then server side throw a exception:

FTR: warning: dispatch exception: ../../include\Ice/BasicStream.h:112: Ice::Unma
rshalOutOfBoundsException:
protocol error: out of bounds during unmarshaling
identity: FTR
facet:
operation: Bad

and php client side throw a exception:

Ice_UnknownLocalException Object
( [unknown] => ../../include\Ice/BasicStream.h:112: Ice::UnmarshalOutOfBoundsException: protocol error: out of bounds during

unmarshaling [message:protected] => [string:private] => [code:protected] => 0 [file:protected] =>

D:\temp\jetrocket\webroot\ftr_test.php [line:protected] => 29 [trace:private] => Array ( ) )
1.txt 2.5K

Comments

  • mes
    mes California
    Hi,

    Thanks for the bug report, the sample code really helps us resolve issues more quickly!

    This is indeed a bug, and it has been fixed for the next release. You can work around this bug by initializing the members of UserMessage to empty strings:
    $um = new jf_nation_UserMessage;
    $um->User = "";
    $um->Pwd = "";
    $um->Group = "";
    $um->Session = "";
    
    Take care,
    - Mark
  • please try this

    slice:
    struct Connection
    {
    // user Id
    long Id;
    };
    struct DbIdentity
    {
    long id;
    };
    struct RcIdentity
    {
    // Real Record ID
    long realId;
    };

    string GetSearchRecordContent(
    int encoding,
    Connection cn,
    DbIdentity dbNum,
    string exp, // expression
    RcIdentity rc,
    string LocalDirectory
    );

    exception...
  • mes
    mes California
    Before I can help I would need to see your PHP code and the exception you're receiving.

    - Mark
  • ok

    I will post the sample code later.