Skip to content

Commit

Permalink
php-mapscript allow setting NULL template (#4443)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbonfort committed Sep 6, 2012
1 parent f8d8837 commit 191d0c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mapscript/php/class.c
Expand Up @@ -216,6 +216,11 @@ PHP_METHOD(classObj, __set)

php_class = (php_class_object *) zend_object_store_get_object(zobj TSRMLS_CC);

/* special case for "template" which we want to set to NULL and not an empty string */
if(Z_TYPE_P(value)==IS_NULL && !strcmp(property,"template")) {
msFree(php_class->class->template);
php_class->class->template = NULL;
} else
IF_SET_STRING("name", php_class->class->name, value)
else IF_SET_STRING("title", php_class->class->title, value)
else IF_SET_LONG("type", php_class->class->type, value)
Expand Down
5 changes: 5 additions & 0 deletions mapscript/php/layer.c
Expand Up @@ -343,6 +343,11 @@ PHP_METHOD(layerObj, __set)

php_layer = (php_layer_object *) zend_object_store_get_object(zobj TSRMLS_CC);

/* special case for "template" which we want to set to NULL and not an empty string */
if(Z_TYPE_P(value)==IS_NULL && !strcmp(property,"template")) {
msFree(php_layer->layer->template);
php_layer->layer->template = NULL;
} else
IF_SET_LONG("status", php_layer->layer->status, value)
else IF_SET_LONG("debug", php_layer->layer->debug, value)
else IF_SET_STRING("classitem", php_layer->layer->classitem, value)
Expand Down

0 comments on commit 191d0c9

Please sign in to comment.