|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-07-11 12:02 UTC] fra423-spam at yahoo dot fr
Description: ------------ Hi, When I try to upgrade or install SQLITE via PECL (pecl install sqlite), i've got some compilation errors. It seems to be a bug : -- running: make /bin/bash /var/tmp/pear-build-root/SQLite-1.0.3/libtool --mode=compile gcc -I/tmp/tmp8laqB1/SQLite-1.0.3/libsqlite/src -I. -I/tmp/tmp8laqB1/SQLite-1.0.3 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/SQLite-1.0.3/include -I/var/tmp/pear-build-root/SQLite-1.0.3/main -I/tmp/tmp8laqB1/SQLite-1.0.3 -I/opt/csw/php5/include/php -I/opt/csw/php5/include/php/main -I/opt/csw/php5/include/php/TSRM -I/opt/csw/php5/include/php/Zend -I/opt/csw/php5/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c -o sqlite.lo mkdir .libs gcc -I/tmp/tmp8laqB1/SQLite-1.0.3/libsqlite/src -I. -I/tmp/tmp8laqB1/SQLite-1.0.3 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/SQLite-1.0.3/include -I/var/tmp/pear-build-root/SQLite-1.0.3/main -I/tmp/tmp8laqB1/SQLite-1.0.3 -I/opt/csw/php5/include/php -I/opt/csw/php5/include/php/main -I/opt/csw/php5/include/php/TSRM -I/opt/csw/php5/include/php/Zend -I/opt/csw/php5/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c -fPIC -DPIC -o .libs/sqlite.o /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c:56: error: `BYREF_NONE' undeclared here (not in a function) /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c:56: error: initializer element is not constant /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c:56: error: (near initialization for `arg3_force_ref[1]') /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c:56: error: `BYREF_NONE' undeclared here (not in a function) /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c:56: error: initializer element is not constant /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c:56: error: (near initialization for `arg3_force_ref[2]') /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c:56: error: `BYREF_FORCE' undeclared here (not in a function) /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c:56: error: initializer element is not constant /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c:56: error: (near initialization for `arg3_force_ref[3]') /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c:125: warning: initialization from incompatible pointer type /tmp/tmp8laqB1/SQLite-1.0.3/sqlite.c:126: warning: initialization from incompatible pointer type *** Error code 1 make: Fatal error: Command failed for target `sqlite.lo' ERROR: `make' failed -- I have tried to download the package (pear download pecl/sqlite) and installed it and I've got the same problem. --- PHP 5.1.2 PHP API 20041225 PHP Extension 20050922 Zend Extension 220051025 --- Configure Command './configure' '--prefix=/opt/csw/php5' '--enable-force-cgi-redirect' '--enable-discard-path' '--disable-static' '--with-libxml-dir=/opt/csw' '--enable-dom=shared' '--with-openssl=shared,/opt/csw' '--with-kerberos=/opt/csw' '--with-zlib=shared,/opt/csw' '--enable-bcmath=shared' '--with-bz2=shared,/opt/csw' '--enable-calendar=shared' '--with-curl=shared,/opt/csw' '--with-iconv=shared,/opt/csw' '--enable-dba=shared' '--with-ndbm' '--with-gdbm=/opt/csw' '--with-db4=/opt/csw/bdb43' '--with-inifile' '--enable-ftp=shared' '--with-gd=shared,/opt/csw' '--with-jpeg-dir=/opt/csw' '--with-png-dir=/opt/csw' '--with-zlib-dir=/opt/csw' '--with-xpm-dir=/opt/csw' '--with-freetype-dir=/opt/csw' '--with-t1lib=/opt/csw' '--enable-gd-native-ttf' '--enable-gd-jis-conv' '--enable-exif=shared' '--with-gettext=shared,/opt/csw' '--with-gmp=shared,/opt/csw' '--with-ldap=shared,/opt/csw' '--with-ldap-sasl=/opt/csw' '--enable-mbstring=shared' '--enable-pdo=shared' '--with-mssql=shared,/opt/csw' '--with-mysql=shared,/opt/csw/mysql4' '--with-pdo-mysql=shared,/opt/csw/mysql4' '--with-mysqli=shared' '--with-unixODBC=shared,/opt/csw' '--with-pdo-odbc=shared,unixODBC,/opt/csw' '--with-pgsql=shared,/opt/csw/postgresql/bin/sparcv8' '--with-pdo-pgsql=shared,/opt/csw/postgresql/bin/sparcv8' '--with-pspell=shared,/opt/csw' '--with-readline=shared,/opt/csw' '--with-mm=/opt/csw' '--enable-shmop=shared' '--with-openssl-dir=/opt/csw' '--with-snmp=shared,/opt/csw' '--enable-soap=shared' '--enable-sockets=shared' '--with-sqlite=shared,/opt/csw' '--with-pdo-sqlite=shared,/opt/csw' '--enable-sqlite-utf8' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-xml' '--with-expat-dir=/opt/csw' '--with-xsl=shared,/opt/csw' '--enable-wddx=shared' '--enable-xmlreader=shared' '--with-apxs2=/opt/csw/apache2/sbin/apxs' '--with-imap=../imap-2004f' '--with-imap-ssl=/opt/csw/ssl' '--with-kerberos=/opt/csw' Expected result: ---------------- I expected to have extension sqlite.so compiled. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 03:00:01 2025 UTC |
Here's a patch for 1.0.3: diff -Naur SQLite-1.0.3.orig/sqlite.c SQLite-1.0.3/sqlite.c --- SQLite-1.0.3.orig/sqlite.c 2004-07-18 10:23:18.000000000 +0000 +++ SQLite-1.0.3/sqlite.c 2007-12-06 10:55:23.000000000 +0000 @@ -53,7 +53,7 @@ extern int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out); extern int sqlite_decode_binary(const unsigned char *in, unsigned char *out); -static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; +/*static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };*/ static int le_sqlite_db, le_sqlite_result, le_sqlite_pdb; @@ -122,8 +122,8 @@ enum { PHPSQLITE_ASSOC = 1, PHPSQLITE_NUM = 2, PHPSQLITE_BOTH = PHPSQLITE_ASSOC|PHPSQLITE_NUM }; function_entry sqlite_functions[] = { - PHP_FE(sqlite_open, arg3_force_ref) - PHP_FE(sqlite_popen, arg3_force_ref) + PHP_FE(sqlite_open, third_arg_force_ref) + PHP_FE(sqlite_popen, third_arg_force_ref) PHP_FE(sqlite_close, NULL) PHP_FE(sqlite_query, NULL) PHP_FE(sqlite_exec, NULL)I had the same issue, so I ported the code so it can compile for PHP 5.4.x. Here is my patch: --- SQLite-1.0.3/sqlite.c 2004-07-18 13:23:18.000000000 +0300 +++ SQLite-1.0.3-mm/sqlite.c 2012-06-08 10:03:16.000000000 +0300 @@ -31,6 +31,10 @@ #include "ext/standard/info.h" #include "php_sqlite.h" +#define BYREF_NONE 0 +#define BYREF_FORCE 1 +#define BYREF_ALLOW 2 + #if HAVE_TIME_H # include <time.h> #endif @@ -121,7 +125,7 @@ struct php_sqlite_agg_functions { enum { PHPSQLITE_ASSOC = 1, PHPSQLITE_NUM = 2, PHPSQLITE_BOTH = PHPSQLITE_ASSOC|PHPSQLITE_NUM }; -function_entry sqlite_functions[] = { +zend_function_entry sqlite_functions[] = { PHP_FE(sqlite_open, arg3_force_ref) PHP_FE(sqlite_popen, arg3_force_ref) PHP_FE(sqlite_close, NULL) @@ -482,7 +486,7 @@ static void php_sqlite_agg_step_function if (*context_p == NULL) { MAKE_STD_ZVAL(*context_p); - (*context_p)->is_ref = 1; +// (*context_p)->is_ref = 1; Z_TYPE_PP(context_p) = IS_NULL; } @@ -590,9 +594,11 @@ static int php_sqlite_authorizer(void *a case SQLITE_COPY: if (strncmp(arg4, ":memory:", sizeof(":memory:") - 1)) { TSRMLS_FETCH(); +/* Not compatible with PHP 5.4.x 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; @@ -603,9 +609,11 @@ static int php_sqlite_authorizer(void *a case SQLITE_ATTACH: if (strncmp(arg3, ":memory:", sizeof(":memory:") - 1)) { TSRMLS_FETCH(); +/* Not compatible with PHP 5.4.x 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; @@ -736,7 +744,8 @@ static struct php_sqlite_db *php_sqlite_ db->rsrc_id = ZEND_REGISTER_RESOURCE(return_value, db, persistent_id ? le_sqlite_pdb : le_sqlite_db); if (persistent_id) { - list_entry le; +// list_entry le; + zend_rsrc_list_entry le; Z_TYPE(le) = le_sqlite_pdb; le.ptr = db; @@ -760,7 +769,8 @@ PHP_FUNCTION(sqlite_popen) long filename_len, hashkeylen; zval *errmsg = NULL; struct php_sqlite_db *db = NULL; - list_entry *le; + //list_entry *le; + zend_rsrc_list_entry *le; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/", &filename, &filename_len, &mode, &errmsg)) { @@ -774,9 +784,11 @@ PHP_FUNCTION(sqlite_popen) /* resolve the fully-qualified path name to use as the hash key */ fullpath = expand_filepath(filename, NULL TSRMLS_CC); +/* Not compatible with PHP 5.4.x if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { RETURN_FALSE; } +*/ if (php_check_open_basedir(fullpath TSRMLS_CC)) { RETURN_FALSE; @@ -847,10 +859,12 @@ PHP_FUNCTION(sqlite_open) /* resolve the fully-qualified path name to use as the hash key */ fullpath = expand_filepath(filename, NULL TSRMLS_CC); +/* Not compatible with PHP 5.4.x if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { efree(fullpath); RETURN_FALSE; } +*/ if (php_check_open_basedir(fullpath TSRMLS_CC)) { efree(fullpath);A few notes: 1. The PECL version of the sqlite extension has been dead for a long time. Nobody should have been attempting to install it since around 2007 2. As of PHP 5.4.0, ext/sqlite no longer exists, which means the pecl version of this extension should live again (which means, a release should be made) 3. We should have a new pecl/sqlite release that: A) Uses the latest source from ext/sqlite B) Works with PHP 5.4.0 and above (and below) C) Also installs pdo_sqlite2 This was worked on once before and I even tested a patch, but I've since lost said patch and forgot about the progress made. However, this bug report being open may help. Johannes created the patch.