From 3b02f55e16bc3b2e722848f323cac52b26aaaa31 Mon Sep 17 00:00:00 2001 From: Vladimir Kolesnikov Date: Thu, 26 Sep 2013 16:12:24 +0300 Subject: [PATCH 1/2] Fix misleading diagnostics on exception --- ext/kernel/fcall.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 { From 1b4f5f271c2e329a06acf66e0130ce329554367f Mon Sep 17 00:00:00 2001 From: Vladimir Kolesnikov Date: Thu, 26 Sep 2013 16:35:32 +0300 Subject: [PATCH 2/2] Regression test --- ext/tests/issue-1297.phpt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ext/tests/issue-1297.phpt 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