Permalink
Browse files

Fix rectObj->draw fails to render text in php/mapscript (#4577)

  • Loading branch information...
1 parent 829e4a8 commit 3c14a7cf385fd4edb18ac5e839d26cb4d1a7b87e Alan Boudreault committed Feb 6, 2013
Showing with 7 additions and 3 deletions.
  1. +5 −1 mapscript/php/mapscript_i.c
  2. +2 −2 mapscript/php/rect.c
@@ -1477,8 +1477,12 @@ int rectObj_draw(rectObj *self, mapObj *map, layerObj *layer,
msInitShape(&shape);
msRectToPolygon(*self, &shape);
shape.classindex = classindex;
- shape.text = strdup(text);
+ if (text) {
+ shape.text = strdup(text);
+ msShapeGetAnnotation(layer, &shape);
+ }
+
msDrawShape(map, layer, &shape, img, -1, MS_DRAWMODE_FEATURES|MS_DRAWMODE_LABELS);
msFreeShape(&shape);
@@ -121,7 +121,7 @@ PHP_METHOD(rectObj, draw)
{
zval *zobj = getThis();
zval *zmap, *zlayer, *zimage;
- char *text;
+ char *text = NULL;
long text_len;
long classIndex;
int status = MS_FAILURE;
@@ -131,7 +131,7 @@ PHP_METHOD(rectObj, draw)
php_image_object *php_image;
PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OOOls",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OOOl|s",
&zmap, mapscript_ce_map,
&zlayer, mapscript_ce_layer,
&zimage, mapscript_ce_image,

0 comments on commit 3c14a7c

Please sign in to comment.