]> granicus.if.org Git - php/commitdiff
Ignore the return value of sqlite3->busyTimeout() if their "API Armor" is not enabled.
authorKalle Sommer Nielsen <kalle@php.net>
Thu, 20 Oct 2016 08:56:08 +0000 (10:56 +0200)
committerKalle Sommer Nielsen <kalle@php.net>
Thu, 20 Oct 2016 08:56:08 +0000 (10:56 +0200)
The sqlite3_busy_timeout() function can only ever return SQLITE_OK if the armor is not compiled in, which means we can skip this error check

ext/sqlite3/sqlite3.c

index 601b0e8e182928244ba121b81c20844e7b3e301e..969eb310a137224ddcb09dbb1988eb9dc45e4ca1 100644 (file)
@@ -306,7 +306,9 @@ PHP_METHOD(sqlite3, busyTimeout)
        php_sqlite3_db_object *db_obj;
        zval *object = getThis();
        zend_long ms;
+#ifdef SQLITE_ENABLE_API_ARMOR
        int return_code;
+#endif
        db_obj = Z_SQLITE3_DB_P(object);
 
        SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
@@ -315,11 +317,15 @@ PHP_METHOD(sqlite3, busyTimeout)
                return;
        }
 
+#ifdef SQLITE_ENABLE_API_ARMOR
        return_code = sqlite3_busy_timeout(db_obj->db, ms);
        if (return_code != SQLITE_OK) {
                php_sqlite3_error(db_obj, "Unable to set busy timeout: %d, %s", return_code, sqlite3_errmsg(db_obj->db));
                RETURN_FALSE;
        }
+#else
+       php_ignore_value(sqlite3_busy_timeout(db_obj->db, ms));
+#endif
 
        RETURN_TRUE;
 }