Opened 14 years ago
Last modified 14 years ago
#3412 closed defect
PHP MapScript integer passing broken on 64bit systems — at Version 1
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 )
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.