Skip to content

Commit

Permalink
Assign should return $this not boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed Dec 31, 2013
1 parent 0d977ee commit b7c2090
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions views/yaf_view_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,15 +746,19 @@ PHP_METHOD(yaf_view_simple, assign) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == FAILURE) {
return;
}
RETURN_BOOL(yaf_view_simple_assign_multi(getThis(), value TSRMLS_CC));
if (yaf_view_simple_assign_multi(getThis(), value TSRMLS_CC)) {
RETURN_ZVAL(getThis(), 1, 0);
}
} else if (argc == 2) {
zval *value;
char *name;
uint len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &len, &value) == FAILURE) {
return;
}
RETURN_BOOL(yaf_view_simple_assign_single(getThis(), name, len, value TSRMLS_CC));
if (yaf_view_simple_assign_single(getThis(), name, len, value TSRMLS_CC)){
RETURN_ZVAL(getThis(), 1, 0);
}
} else {
WRONG_PARAM_COUNT;
}
Expand All @@ -776,7 +780,7 @@ PHP_METHOD(yaf_view_simple, assignRef) {

Z_ADDREF_P(value);
if (zend_hash_update(Z_ARRVAL_P(tpl_vars), name, len + 1, &value, sizeof(zval *), NULL) == SUCCESS) {
RETURN_TRUE;
RETURN_ZVAL(getThis(), 1, 0);
}
RETURN_FALSE;
}
Expand Down

0 comments on commit b7c2090

Please sign in to comment.