Archived
This forum has been archived. Please start a new discussion on GitHub.
about icephp
error log in apache with icephp.
my ice slice:
module test1{
module test2{
module test3{
struct st1
{
long n0;
long n1;
};
dictionary<st1,long> dict1;
}
}
}
php -r "ice_loadprofile();ice_dumpprofile();"
PHP Warning: PHP Startup: skipping dictionary ::test1::test2::test3::dict1- unsupported key type in Unknown on line 0
(and if i want to use "st1", i should write "test1_test2_test3_st1". am i right?)
so i want to know if icephp support this kind of dictionary definition.
and another question is about "long" (64bits)type in icephp. what i should do if i want to use "long"(using string type in my php code?)
my ice slice:
module test1{
module test2{
module test3{
struct st1
{
long n0;
long n1;
};
dictionary<st1,long> dict1;
}
}
}
php -r "ice_loadprofile();ice_dumpprofile();"
PHP Warning: PHP Startup: skipping dictionary ::test1::test2::test3::dict1- unsupported key type in Unknown on line 0
(and if i want to use "st1", i should write "test1_test2_test3_st1". am i right?)
so i want to know if icephp support this kind of dictionary definition.
and another question is about "long" (64bits)type in icephp. what i should do if i want to use "long"(using string type in my php code?)
0
Comments
-
so i want to know if icephp support this kind of dictionary definition.
Slice dictionaries map to native PHP associative arrays. The PHP mapping does not currently support all Slice dictionary types, however, because native PHP associative arrays support only integer and string key types.
We may add a solution for this limitation in some future release, but so far there has been no demand for it.and another question is about "long" (64bits)type in icephp. what i should do if i want to use "long"(using string type in my php code?)
Hope that helps,
- Mark0 -
thanks.
another question about long in IcePHP
if i want to receive user input "long" type (exceeds the range of PHP's native integer type) as a parameter of some ICE function, what should i do?
i have to use a string type in php to receive the user input. then, i get a proxy,and pass the string to the function like this, prx->myfunc(userstring).
but in the slice file, the definition of myfunc is like this, ... myfunc (Ice::Long)...
so apache server (with IcePHP) will raise error like this,"PHP Fatal error ... invalid long value..."
i am confused.0 -
and what about if myfunc(...) need a parameter like a struct st1.
struct st1
{
long n0;
long n1;
};
how do i initialize st1 and pass st1 as a parameter of prx->myfunc(...)0 -
Hi,the definition of myfunc is like this, ... myfunc (Ice::Long)...
so apache server (with IcePHP) will raise error like this,"PHP Fatal error ... invalid long value..."and what about if myfunc(...) need a parameter like a struct st1.
struct st1
{
long n0;
long n1;
};
how do i initialize st1 and pass st1 as a parameter of prx->myfunc(...)$mystruct = new mymodule_st1; $mystruct->n0 = ... $mystruct->n1 = ... $prx->myfunc($mystruct);
Take care,
- Mark0 -
i do as you suggest in my code like this:
slice definitionmodule mymodule { struct st { long n0; long n1; } struct st1 { int key; struct st myst; } }
my PHP program... function getValue(...) { $mystruct = new mymodule_st1; $mystruct->key = 1; // n0,n1 just give some example values here for demonstration.... $mystruct->myst->n0 = gmp_strval(gmp_init("0xEFCDAB8967452301")); $mystruct->myst->n1 = gmp_strval(gmp_init("0xEFCDAB8967452301")); return mymodule_st1; } ... $val = getValue(...); $prx->myfunc($val);
when i use var_dump to see the variable mymodule_st1 in getValue().object(mymodule_st1)#2 (2) { ["key"]=> int(1) ["myst"]=> object(mymodule_st)#4 (2) { ["n0"]=> string(20) "17279655951921914625" ["n1"]=> string(20) "17279655951921914625" } }
it seems ok after$val = getValue(...);
but when it comes to the next line of code , some error occursPHP Fatal error: Ice_ObjectPrx::myfunc() [<a href='function.Ice-ObjectPrx-myfunc'>function.Ice-ObjectPrx-myfunc</a>]: invalid long value `17279655951921914625' in /home/apache/test.php on line 91, referer: http://192.168.1.1/test.php
0 -
The maximum value of a 64-bit signed integer is 9,223,372,036,854,775,807, and your program is attempting to use 17,279,655,951,921,914,625.
Take care,
- Mark0 -
thanks, it works.
but complement should be used to present a 64-bits long long (signed) in my testcase.( CentOS .6.9-55.3.ELsmp x86_64+ apache2.0.52 + php 5.1.4)0