Skip to content

Commit

Permalink
Merge pull request #1297 from sjinks/fcall-diag
Browse files Browse the repository at this point in the history
Fix misleading diagnostics on exception
  • Loading branch information
Phalcon committed Sep 26, 2013
2 parents aa8090b + 1b4f5f2 commit c33d65a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ext/kernel/fcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
21 changes: 21 additions & 0 deletions ext/tests/issue-1297.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
Misleading diagnostocs on exception - https://github.com/phalcon/cphalcon/pull/1297
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
try {
$object = new stdClass();
$form = new \Phalcon\Forms\Form($object);
$form->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

0 comments on commit c33d65a

Please sign in to comment.