amfPHP功能输入故障

I'm writing an amfPHP function which should take string input. It takes alphanumeric characters without a problem, but unfortunately it returns data as "2" if I send "2.UgnFl4kAWovazp_tVo6fHg__.86400.1260025200-571701419" as parameter.

here is the function (real simple as you can see)

function checkOpenSession($guid, $session_key) {
        return $session_key;
}

I just tried this with a simple setup, and just writing the results to a file from the service browser and it seems to be ok for me. So the problem would seem to be in the calling end.

Another possibility is that amfphp changes the datatype of the returned value from a string to an int because of the leading integer. Try putting a some alphanumeric character at the start of the return string and see what that does.

double quote your strings... that will work it out.

This behavior is actually present in the AMFPHP service browser(bug), so it is easy to mistake it as the AMFPHP that is converting number-leading strings to int. However the problem is in the sending code. For instance sending a urlencoded string through the json gateway works properly (Objective C code):

NSString *theUrl = [[NSString alloc] initWithFormat:@"%@/modules/amfphp/amfphp/json.php/MysqlRemoting.checkAuth/%@/%@/1", kServerBaseUrl, userName, passMD5];
NSString *encodedUrl = [theUrl stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding];

Where passMD5 may have a leading number. But if I enter appropriate values for the checkAuth method in the service browser, it is broken.

[edit]

$value = urldecode($value);
if($value != "") {
if($value[0] != '[' && $value[0] != '{' && $value != "null" && $value != "false" && $value != "true") {
$hasAlpha = false;
//check to see if it is a number
$sl = strlen($value);
for ($i = 0; $i < $sl; $i++) {
    $char1 = ord($value[$i]);
    if($char1 >= 0x30 && $char1 <= 0x39) {
    //Then this is a number
    } else { //Else leave value as is */
    $hasAlpha = true;
    }
    }
    if (!$hasAlpha) $value = json_decode($value, true);
}
        else
        {
            $value = json_decode($value, true);
        }
    }

To bypass this service browser bug, double quote your entry on the service browser if you expect a string on an argument and this string starts with a number. I was having the same problem testing some methods via service browser and it worked fine.