Opened 14 years ago

Closed 14 years ago

#3412 closed defect (fixed)

PHP MapScript integer passing broken on 64bit systems

Reported by: warmerdam Owned by: aboudreault
Priority: normal Milestone:
Component: MapScript-PHP Version: svn-trunk (development)
Severity: normal Keywords:
Cc: janh

Description (last modified by warmerdam)

I am seeing a value of zero for width in the code when the setSize() function below is called:

<?
dl('php_mapscript.so');
$oMap = ms_newMapobj("warmerdam.map");
$oMap->setSize(400,400);
header("content-type:image/gif");
$img = $oMap->draw();
$img->saveImage("");
?>

It turns out this is because width and height are declared as integers in zim_mapObj_setSize(), but the "l" specifier in zend_parse_parameters expects a pointer to a long. On 32bit systems these are generally the same, but on 64bit systems (with the exception of Win64) a long and an int are different sizes resulting in various sorts of problems. The fix is to declare the variables as long instead of int. Skimming the rest of the php bindings this problem appears to be endemic.

Change History (5)

comment:1 by warmerdam, 14 years ago

Description: modified (diff)

comment:2 by aboudreault, 14 years ago

I'm going to replace all int variables by long variables.

comment:3 by aboudreault, 14 years ago

Fixed and committed in r10030. Can anyone test and confirm that everything seems correct ?

comment:4 by janh, 14 years ago

I tested it on a few applications using PHP that crashed in earlier trunk versions. They look OK now, so you can close this ticket. I hope this is the last of the 64-bit related errors.

Jan

comment:5 by aboudreault, 14 years ago

Resolution: fixed
Status: newclosed

Thanks janh for testing.

Note: See TracTickets for help on using tickets.