diff --git a/ext/kernel/fcall.c b/ext/kernel/fcall.c index 0227bf7f25c..03310a0c88b 100644 --- a/ext/kernel/fcall.c +++ b/ext/kernel/fcall.c @@ -201,7 +201,7 @@ static int phalcon_call_func_vparams(zval *return_value, zval **return_value_ptr efree(params); } - if (status == FAILURE) { + if (status == FAILURE && !EG(exception)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(func)); } else if (EG(exception)) { @@ -268,9 +268,8 @@ int phalcon_call_method_vparams(zval *return_value, zval **return_value_ptr, zva efree(params); } - if (status == FAILURE) { + if (status == FAILURE && !EG(exception)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined method %s::%s()", ce->name, method_name); - status = FAILURE; } else if (EG(exception)) { status = FAILURE; @@ -336,7 +335,7 @@ static int phalcon_call_static_zval_str_func_vparams(zval *return_value, zval ** efree(params); } - if (status == FAILURE) { + if (status == FAILURE && !EG(exception)) { if (Z_TYPE_P(mixed_name) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function %s::%s()", Z_STRVAL_P(mixed_name), method_name); } else { diff --git a/ext/tests/issue-1297.phpt b/ext/tests/issue-1297.phpt new file mode 100644 index 00000000000..1727b2808de --- /dev/null +++ b/ext/tests/issue-1297.phpt @@ -0,0 +1,21 @@ +--TEST-- +Misleading diagnostocs on exception - https://github.com/phalcon/cphalcon/pull/1297 +--SKIPIF-- + +--FILE-- +add(new \Phalcon\Forms\Element\Text("title")); + echo $form->render('title'); +} +catch (\Exception $e) { + echo $e->getMessage(), PHP_EOL; +} + +echo "OK", PHP_EOL; +?> +--EXPECT-- +A dependency injector container is required to obtain the "escaper" service +OK