[packages] php5: add sqlite extension
This extension was dropped with the release 5.4 of php and there is a reference to a pecl module in the changelog. However, the pecl module doesn't exist (yet) so this is a 'backport' of the latest sqlite extension of php's 5.3 branch. This is not tested completely. Signed-off-by: Michael Heimpold <mhei@heimpold.de> git-svn-id: svn://svn.openwrt.org/openwrt/packages@32877 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
b222004734
commit
0232955fc4
50845
lang/php5/patches/090-restore-sqlite2.patch
Normal file
50845
lang/php5/patches/090-restore-sqlite2.patch
Normal file
File diff suppressed because it is too large
Load Diff
101
lang/php5/patches/091-fix-sqlite2.patch
Normal file
101
lang/php5/patches/091-fix-sqlite2.patch
Normal file
@ -0,0 +1,101 @@
|
||||
--- a/ext/sqlite/pdo_sqlite2.c
|
||||
+++ b/ext/sqlite/pdo_sqlite2.c
|
||||
@@ -522,11 +522,6 @@ static char *make_filename_safe(const ch
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
|
||||
- efree(fullpath);
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
if (php_check_open_basedir(fullpath TSRMLS_CC)) {
|
||||
efree(fullpath);
|
||||
return NULL;
|
||||
@@ -585,7 +580,7 @@ static int pdo_sqlite2_handle_factory(pd
|
||||
|
||||
if (!filename) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC,
|
||||
- "safe_mode/open_basedir prohibits opening %s",
|
||||
+ "open_basedir prohibits opening %s",
|
||||
dbh->data_source);
|
||||
goto cleanup;
|
||||
}
|
||||
--- a/ext/sqlite/sqlite.c
|
||||
+++ b/ext/sqlite/sqlite.c
|
||||
@@ -1066,10 +1066,6 @@ static int php_sqlite_authorizer(void *a
|
||||
case SQLITE_COPY:
|
||||
if (strncmp(arg4, ":memory:", sizeof(":memory:") - 1)) {
|
||||
TSRMLS_FETCH();
|
||||
- if (PG(safe_mode) && (!php_checkuid(arg4, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
|
||||
- return SQLITE_DENY;
|
||||
- }
|
||||
-
|
||||
if (php_check_open_basedir(arg4 TSRMLS_CC)) {
|
||||
return SQLITE_DENY;
|
||||
}
|
||||
@@ -1079,10 +1075,6 @@ static int php_sqlite_authorizer(void *a
|
||||
case SQLITE_ATTACH:
|
||||
if (strncmp(arg3, ":memory:", sizeof(":memory:") - 1)) {
|
||||
TSRMLS_FETCH();
|
||||
- if (PG(safe_mode) && (!php_checkuid(arg3, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
|
||||
- return SQLITE_DENY;
|
||||
- }
|
||||
-
|
||||
if (php_check_open_basedir(arg3 TSRMLS_CC)) {
|
||||
return SQLITE_DENY;
|
||||
}
|
||||
@@ -1160,13 +1152,12 @@ static void sqlite_object_free_storage(v
|
||||
static void sqlite_object_new(zend_class_entry *class_type, zend_object_handlers *handlers, zend_object_value *retval TSRMLS_DC)
|
||||
{
|
||||
sqlite_object *intern;
|
||||
- zval *tmp;
|
||||
|
||||
intern = emalloc(sizeof(sqlite_object));
|
||||
memset(intern, 0, sizeof(sqlite_object));
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
+ object_properties_init(&intern->std, class_type);
|
||||
|
||||
retval->handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) sqlite_object_free_storage, NULL TSRMLS_CC);
|
||||
retval->handlers = handlers;
|
||||
@@ -1510,7 +1501,7 @@ static struct php_sqlite_db *php_sqlite_
|
||||
/* authorizer hook so we can enforce safe mode
|
||||
* Note: the declaration of php_sqlite_authorizer is correct for 2.8.2 of libsqlite,
|
||||
* and IS backwards binary compatible with earlier versions */
|
||||
- if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {
|
||||
+ if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
sqlite_set_authorizer(sdb, php_sqlite_authorizer, NULL);
|
||||
}
|
||||
|
||||
@@ -1569,8 +1560,7 @@ PHP_FUNCTION(sqlite_popen)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
- if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
|
||||
- php_check_open_basedir(fullpath TSRMLS_CC)) {
|
||||
+ if (php_check_open_basedir(fullpath TSRMLS_CC)) {
|
||||
efree(fullpath);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1656,8 +1646,7 @@ PHP_FUNCTION(sqlite_open)
|
||||
}
|
||||
}
|
||||
|
||||
- if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
|
||||
- php_check_open_basedir(fullpath TSRMLS_CC)) {
|
||||
+ if (php_check_open_basedir(fullpath TSRMLS_CC)) {
|
||||
efree(fullpath);
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
if (object) {
|
||||
@@ -1710,8 +1699,7 @@ PHP_FUNCTION(sqlite_factory)
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
- if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
|
||||
- php_check_open_basedir(fullpath TSRMLS_CC)) {
|
||||
+ if (php_check_open_basedir(fullpath TSRMLS_CC)) {
|
||||
efree(fullpath);
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
RETURN_NULL();
|
Loading…
x
Reference in New Issue
Block a user