From: John Koleszar <jkoleszar@on...>  20051129 13:56:50

Hi all, I'm trying to convert some existing SWIG PERL bindings to PHP and am having trouble with the multivariable typemaps. I have a function with the prototype: unsigned char MyGetBool(void *handle, unsigned char *result); and the following typemap: %apply unsigned char *OUTPUT { unsigned char * } The return value is a status code. I'm expecting an array containing a status code and the result to be returned from the function. When I invoke the function, I get a strange selfreferrential multidimensional array: Code snippet: $res = MyGetBool($h); if(is_array($res)) {print_r(array_keys($res));} if(is_array($res[0])) {print_r(array_keys($res[0]));} if(is_array($res[0][0])) {print_r(array_keys($res[0][0]));} if(is_array($res[0][0][0])) {print_r(array_keys($res[0][0][0]));} print "Index 0: ".$res[0]."\n"; print "Index 1: ".$res[1]."\n"; print "Index 2: ".$res[2]."\n"; Example Output: Array ( [0] => 0 [1] => 1 ) Array ( [0] => 0 [1] => 1 ) Array ( [0] => 0 [1] => 1 ) Array ( [0] => 0 [1] => 1 ) Index 0: Array Index 1: 0 Index 2: Note that 0 is the expected return value of the function and 1 is the expected value for the result parameter, so it seems that my function is being properly invoked. Is it a known limitation that these typemaps don't work for PHP yet, or have I stumbled on a bug? I'm new to PHP, so it's very possible I'm doing something wrong there, but it doesn't seem so. Has anybody dealt with this before and can point me in the right direction? Thanks, John Koleszar 