Skip to content

Commit b7c2090

Browse files
committed
Assign should return $this not boolean
1 parent 0d977ee commit b7c2090

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

views/yaf_view_simple.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,15 +746,19 @@ PHP_METHOD(yaf_view_simple, assign) {
746746
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == FAILURE) {
747747
return;
748748
}
749-
RETURN_BOOL(yaf_view_simple_assign_multi(getThis(), value TSRMLS_CC));
749+
if (yaf_view_simple_assign_multi(getThis(), value TSRMLS_CC)) {
750+
RETURN_ZVAL(getThis(), 1, 0);
751+
}
750752
} else if (argc == 2) {
751753
zval *value;
752754
char *name;
753755
uint len;
754756
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &len, &value) == FAILURE) {
755757
return;
756758
}
757-
RETURN_BOOL(yaf_view_simple_assign_single(getThis(), name, len, value TSRMLS_CC));
759+
if (yaf_view_simple_assign_single(getThis(), name, len, value TSRMLS_CC)){
760+
RETURN_ZVAL(getThis(), 1, 0);
761+
}
758762
} else {
759763
WRONG_PARAM_COUNT;
760764
}
@@ -776,7 +780,7 @@ PHP_METHOD(yaf_view_simple, assignRef) {
776780

777781
Z_ADDREF_P(value);
778782
if (zend_hash_update(Z_ARRVAL_P(tpl_vars), name, len + 1, &value, sizeof(zval *), NULL) == SUCCESS) {
779-
RETURN_TRUE;
783+
RETURN_ZVAL(getThis(), 1, 0);
780784
}
781785
RETURN_FALSE;
782786
}

0 commit comments

Comments
 (0)