summaryrefslogtreecommitdiff
path: root/ext/sqlite3/sqlite3.c
diff options
context:
space:
mode:
authorDanack <Danack@basereality.com>2015-02-16 21:45:21 +0000
committerDanack <Danack@basereality.com>2015-02-16 21:45:21 +0000
commit44f15b068d40eb3750864af54126ef25b238e412 (patch)
tree8e6c40348790673bce12e7503f00ab14d0090dd9 /ext/sqlite3/sqlite3.c
parent94e2002de5dc275533922f1753b9a9e666fee404 (diff)
downloadphp-git-44f15b068d40eb3750864af54126ef25b238e412.tar.gz
Stop trying to call the callback after it has thrown an exception. Also, as an exception has been thrown, there is no need to have a separate error message.
Diffstat (limited to 'ext/sqlite3/sqlite3.c')
-rw-r--r--ext/sqlite3/sqlite3.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 556f7861f6..93a865ebfc 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -860,18 +860,23 @@ static int php_sqlite3_callback_compare(void *coll, int a_len, const void *a, in
collation->fci.fci.params = zargs;
- if ((ret = zend_call_function(&collation->fci.fci, &collation->fci.fcc)) == FAILURE) {
- php_error_docref(NULL, E_WARNING, "An error occurred while invoking the compare callback");
+ if (!EG(exception)) {
+ //Exception occurred on previous callback. Don't attempt to call function
+ if ((ret = zend_call_function(&collation->fci.fci, &collation->fci.fcc)) == FAILURE) {
+ php_error_docref(NULL, E_WARNING, "An error occurred while invoking the compare callback");
+ }
}
zval_ptr_dtor(&zargs[0]);
zval_ptr_dtor(&zargs[1]);
efree(zargs);
- //retval ought to contain a ZVAL_LONG by now
- // (the result of a comparison, i.e. most likely -1, 0, or 1)
- //I suppose we could accept any scalar return type, though.
- if (Z_TYPE(retval) != IS_LONG){
+ if (EG(exception)) {
+ ret = 0;
+ } else if (Z_TYPE(retval) != IS_LONG){
+ //retval ought to contain a ZVAL_LONG by now
+ // (the result of a comparison, i.e. most likely -1, 0, or 1)
+ //I suppose we could accept any scalar return type, though.
php_error_docref(NULL, E_WARNING, "An error occurred while invoking the compare callback (invalid return type). Collation behaviour is undefined.");
}else{
ret = Z_LVAL(retval);