--- embedaddon/php/ext/sqlite3/sqlite3.c	2012/05/29 12:34:43	1.1.1.2
+++ embedaddon/php/ext/sqlite3/sqlite3.c	2013/07/22 01:32:02	1.1.1.3
@@ -2,7 +2,7 @@
    +----------------------------------------------------------------------+
    | PHP Version 5                                                        |
    +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2012 The PHP Group                                |
+   | Copyright (c) 1997-2013 The PHP Group                                |
    +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: sqlite3.c,v 1.1.1.2 2012/05/29 12:34:43 misho Exp $ */
+/* $Id: sqlite3.c,v 1.1.1.3 2013/07/22 01:32:02 misho Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -114,7 +114,10 @@ PHP_METHOD(sqlite3, open)
 		zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Already initialised DB Object", 0 TSRMLS_CC);
 	}
 
-	if (strncmp(filename, ":memory:", 8) != 0) {
+	if (strlen(filename) != filename_len) {
+		return;
+	}
+	if (memcmp(filename, ":memory:", sizeof(":memory:")) != 0) {
 		if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) {
 			zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Unable to expand filepath", 0 TSRMLS_CC);
 			return;
@@ -727,7 +730,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci 
 
 		switch (sqlite3_value_type(argv[i])) {
 			case SQLITE_INTEGER:
+#if LONG_MAX > 2147483647
+				ZVAL_LONG(*zargs[i + is_agg], sqlite3_value_int64(argv[i]));
+#else
 				ZVAL_LONG(*zargs[i + is_agg], sqlite3_value_int(argv[i]));
+#endif
 				break;
 
 			case SQLITE_FLOAT:
@@ -771,7 +778,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci 
 		if (retval) {
 			switch (Z_TYPE_P(retval)) {
 				case IS_LONG:
+#if LONG_MAX > 2147483647
+					sqlite3_result_int64(context, Z_LVAL_P(retval));
+#else
 					sqlite3_result_int(context, Z_LVAL_P(retval));
+#endif
 					break;
 
 				case IS_NULL:
@@ -1094,7 +1105,7 @@ static int php_sqlite3_stream_close(php_stream *stream
 	php_stream_sqlite3_data *sqlite3_stream = (php_stream_sqlite3_data *) stream->abstract;
 	
 	if (sqlite3_blob_close(sqlite3_stream->blob) != SQLITE_OK) {
-		/* Error occured, but it still closed */
+		/* Error occurred, but it still closed */
 	}
 
 	efree(sqlite3_stream);
@@ -1398,7 +1409,7 @@ static int register_bound_parameter_to_sqlite(struct p
 /* }}} */
 
 /* {{{ proto bool SQLite3Stmt::bindParam(int parameter_number, mixed parameter [, int type])
-   Bind Paramater to a stmt variable. */
+   Bind Parameter to a stmt variable. */
 PHP_METHOD(sqlite3stmt, bindParam)
 {
 	php_sqlite3_stmt *stmt_obj;
@@ -1490,7 +1501,11 @@ PHP_METHOD(sqlite3stmt, execute)
 			switch (param->type) {
 				case SQLITE_INTEGER:
 					convert_to_long(param->parameter);
+#if LONG_MAX > 2147483647
+					sqlite3_bind_int64(stmt_obj->stmt, param->param_number, Z_LVAL_P(param->parameter));
+#else
 					sqlite3_bind_int(stmt_obj->stmt, param->param_number, Z_LVAL_P(param->parameter));
+#endif
 					break;
 
 				case SQLITE_FLOAT:
@@ -1959,7 +1974,7 @@ static int php_sqlite3_authorizer(void *autharg, int a
 	switch (access_type) {
 		case SQLITE_ATTACH:
 		{
-			if (strncmp(arg3, ":memory:", sizeof(":memory:")-1) && *arg3) {
+			if (memcmp(arg3, ":memory:", sizeof(":memory:")) && *arg3) {
 				TSRMLS_FETCH();
 
 #if PHP_API_VERSION < 20100412