Skip to content

Commit

Permalink
Compatible with PHP 8.4 - 3 (#5467)
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFreeman authored Sep 9, 2024
1 parent 5947c35 commit 97d5d54
Show file tree
Hide file tree
Showing 34 changed files with 8,706 additions and 189 deletions.
22 changes: 18 additions & 4 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,10 @@ EOF
thirdparty/php81/pdo_pgsql/pgsql_driver.c \
thirdparty/php81/pdo_pgsql/pgsql_statement.c \
thirdparty/php83/pdo_pgsql/pgsql_driver.c \
thirdparty/php83/pdo_pgsql/pgsql_statement.c"
thirdparty/php83/pdo_pgsql/pgsql_statement.c \
thirdparty/php84/pdo_pgsql/pgsql_driver.c \
thirdparty/php84/pdo_pgsql/pgsql_statement.c \
thirdparty/php84/pdo_pgsql/pgsql_sql_parser.c"
fi

if test "$PHP_SWOOLE_ORACLE" != "no"; then
Expand All @@ -1063,7 +1066,9 @@ EOF
thirdparty/php81/pdo_oci/oci_driver.c \
thirdparty/php81/pdo_oci/oci_statement.c \
thirdparty/php83/pdo_oci/oci_driver.c \
thirdparty/php83/pdo_oci/oci_statement.c"
thirdparty/php83/pdo_oci/oci_statement.c \
thirdparty/php84/pdo_oci/oci_driver.c \
thirdparty/php84/pdo_oci/oci_statement.c"
fi

if test "$PHP_SWOOLE_ODBC" != "no"; then
Expand All @@ -1073,7 +1078,9 @@ EOF
thirdparty/php81/pdo_odbc/odbc_driver.c \
thirdparty/php81/pdo_odbc/odbc_stmt.c \
thirdparty/php83/pdo_odbc/odbc_driver.c \
thirdparty/php83/pdo_odbc/odbc_stmt.c"
thirdparty/php83/pdo_odbc/odbc_stmt.c \
thirdparty/php84/pdo_odbc/odbc_driver.c \
thirdparty/php84/pdo_odbc/odbc_stmt.c"
fi

if test "$PHP_SWOOLE_SQLITE" != "no"; then
Expand All @@ -1083,7 +1090,10 @@ EOF
thirdparty/php81/pdo_sqlite/sqlite_driver.c \
thirdparty/php81/pdo_sqlite/sqlite_statement.c \
thirdparty/php83/pdo_sqlite/sqlite_driver.c \
thirdparty/php83/pdo_sqlite/sqlite_statement.c"
thirdparty/php83/pdo_sqlite/sqlite_statement.c \
thirdparty/php84/pdo_sqlite/sqlite_driver.c \
thirdparty/php84/pdo_sqlite/sqlite_statement.c \
thirdparty/php84/pdo_sqlite/sqlite_sql_parser.c"
fi

SW_ASM_DIR="thirdparty/boost/asm/"
Expand Down Expand Up @@ -1242,20 +1252,24 @@ EOF
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php80/pdo_pgsql)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php81/pdo_pgsql)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php83/pdo_pgsql)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php84/pdo_pgsql)
fi
if test "$PHP_SWOOLE_ODBC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php80/pdo_odbc)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php81/pdo_odbc)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php83/pdo_odbc)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php84/pdo_odbc)
fi
if test "$PHP_SWOOLE_ORACLE" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php80/pdo_oci)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php81/pdo_oci)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php83/pdo_oci)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php84/pdo_oci)
fi
if test "$PHP_SWOOLE_SQLITE" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php80/pdo_sqlite)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php81/pdo_sqlite)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php83/pdo_sqlite)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php84/pdo_sqlite)
fi
fi
10 changes: 8 additions & 2 deletions ext-src/php_swoole_odbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ BEGIN_EXTERN_C()

#include "ext/pdo/php_pdo_driver.h"

#if PHP_VERSION_ID > 80100
#if PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100
#include "thirdparty/php80/pdo_odbc/php_pdo_odbc_int.h"
#elif PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80200
#include "thirdparty/php81/pdo_odbc/php_pdo_odbc_int.h"
#elif PHP_VERSION_ID >= 80200 && PHP_VERSION_ID < 80300
#include "thirdparty/php81/pdo_odbc/php_pdo_odbc_int.h"
#elif PHP_VERSION_ID >= 80300 && PHP_VERSION_ID < 80400
#include "thirdparty/php83/pdo_odbc/php_pdo_odbc_int.h"
#else
#include "thirdparty/php80/pdo_odbc/php_pdo_odbc_int.h"
#include "thirdparty/php84/pdo_odbc/php_pdo_odbc_int.h"
#endif

extern const pdo_driver_t swoole_pdo_odbc_driver;
Expand Down
11 changes: 9 additions & 2 deletions ext-src/php_swoole_oracle.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@
BEGIN_EXTERN_C()

#include "ext/pdo/php_pdo_driver.h"
#if PHP_VERSION_ID >= 80100

#if PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100
#include "thirdparty/php80/pdo_oci/php_pdo_oci_int.h"
#elif PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80200
#include "thirdparty/php81/pdo_oci/php_pdo_oci_int.h"
#elif PHP_VERSION_ID >= 80200 && PHP_VERSION_ID < 80300
#include "thirdparty/php81/pdo_oci/php_pdo_oci_int.h"
#elif PHP_VERSION_ID >= 80300 && PHP_VERSION_ID < 80400
#include "thirdparty/php83/pdo_oci/php_pdo_oci_int.h"
#else
#include "thirdparty/php80/pdo_oci/php_pdo_oci_int.h"
#include "thirdparty/php84/pdo_oci/php_pdo_oci_int.h"
#endif

extern const pdo_driver_t swoole_pdo_oci_driver;
Expand Down
4 changes: 4 additions & 0 deletions ext-src/php_swoole_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ extern zend_object_handlers swoole_exception_handlers;
extern zend_class_entry *swoole_error_ce;
extern zend_class_entry *swoole_resolve_context_ce;
extern zend_object_handlers swoole_resolve_context_handlers;
#if PHP_VERSION_ID >= 80400
extern zend_class_entry *swoole_exit_exception_ce;
extern zend_object_handlers swoole_exit_exception_handlers;
#endif

PHP_FUNCTION(swoole_clear_dns_cache);
PHP_FUNCTION(swoole_last_error);
Expand Down
11 changes: 9 additions & 2 deletions ext-src/php_swoole_sqlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,17 @@
BEGIN_EXTERN_C()

#include "ext/pdo/php_pdo_driver.h"
#if PHP_VERSION_ID >= 80100

#if PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80100
#include "thirdparty/php80/pdo_sqlite/php_pdo_sqlite_int.h"
#elif PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80200
#include "thirdparty/php81/pdo_sqlite/php_pdo_sqlite_int.h"
#elif PHP_VERSION_ID >= 80200 && PHP_VERSION_ID < 80300
#include "thirdparty/php81/pdo_sqlite/php_pdo_sqlite_int.h"
#elif PHP_VERSION_ID >= 80300 && PHP_VERSION_ID < 80400
#include "thirdparty/php83/pdo_sqlite/php_pdo_sqlite_int.h"
#else
#include "thirdparty/php80/pdo_sqlite/php_pdo_sqlite_int.h"
#include "thirdparty/php84/pdo_sqlite/php_pdo_sqlite_int.h"
#endif

extern const pdo_driver_t swoole_pdo_sqlite_driver;
Expand Down
106 changes: 52 additions & 54 deletions thirdparty/php80/pdo_oci/php_pdo_oci_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,91 +17,89 @@
#include <oci.h>

typedef struct {
const char *file;
int line;
sb4 errcode;
char *errmsg;
const char *file;
int line;
sb4 errcode;
char *errmsg;
} pdo_oci_error_info;

/* stuff we use in an OCI database handle */
typedef struct {
OCIServer *server;
OCISession *session;
OCIEnv *env;
OCIError *err;
OCISvcCtx *svc;
/* OCI9; 0 == use NLS_LANG */
ub4 prefetch;
ub2 charset;
sword last_err;
sb4 max_char_width;

unsigned attached:1;
unsigned _reserved:31;

pdo_oci_error_info einfo;
OCIServer *server;
OCISession *session;
OCIEnv *env;
OCIError *err;
OCISvcCtx *svc;
/* OCI9; 0 == use NLS_LANG */
ub4 prefetch;
ub2 charset;
sword last_err;
sb4 max_char_width;

unsigned attached : 1;
unsigned _reserved : 31;

pdo_oci_error_info einfo;
} pdo_oci_db_handle;

typedef struct {
OCIDefine *def;
ub2 fetched_len;
ub2 retcode;
sb2 indicator;
OCIDefine *def;
ub2 fetched_len;
ub2 retcode;
sb2 indicator;

char *data;
ub4 datalen;
char *data;
ub4 datalen;

ub2 dtype;
ub2 dtype;

} pdo_oci_column;

typedef struct {
pdo_oci_db_handle *H;
OCIStmt *stmt;
OCIError *err;
sword last_err;
ub2 stmt_type;
ub4 exec_type;
pdo_oci_column *cols;
pdo_oci_error_info einfo;
unsigned int have_blobs:1;
pdo_oci_db_handle *H;
OCIStmt *stmt;
OCIError *err;
sword last_err;
ub2 stmt_type;
ub4 exec_type;
pdo_oci_column *cols;
pdo_oci_error_info einfo;
unsigned int have_blobs : 1;
} pdo_oci_stmt;

typedef struct {
OCIBind *bind; /* allocated by OCI */
sb2 oci_type;
sb2 indicator;
ub2 retcode;
OCIBind *bind; /* allocated by OCI */
sb2 oci_type;
sb2 indicator;
ub2 retcode;

ub4 actual_len;
ub4 actual_len;

dvoid *thing; /* for LOBS, REFCURSORS etc. */
dvoid *thing; /* for LOBS, REFCURSORS etc. */

unsigned used_for_output;
unsigned used_for_output;
} pdo_oci_bound_param;

extern const struct pdo_stmt_methods swoole_oci_stmt_methods;
extern const ub4 SWOOLE_PDO_OCI_INIT_MODE;
extern OCIEnv *swoole_pdo_oci_Env;

ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, sword status, int isinit, const char *file, int line);
#define oci_init_error(w) _oci_error(H->err, dbh, NULL, w, H->last_err, TRUE, __FILE__, __LINE__)
#define oci_drv_error(w) _oci_error(H->err, dbh, NULL, w, H->last_err, FALSE, __FILE__, __LINE__)
#define oci_stmt_error(w) _oci_error(S->err, stmt->dbh, stmt, w, S->last_err, FALSE, __FILE__, __LINE__)

extern const struct pdo_stmt_methods oci_stmt_methods;
ub4 _oci_error(
OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, sword status, int isinit, const char *file, int line);
#define oci_init_error(w) _oci_error(H->err, dbh, NULL, w, H->last_err, TRUE, __FILE__, __LINE__)
#define oci_drv_error(w) _oci_error(H->err, dbh, NULL, w, H->last_err, FALSE, __FILE__, __LINE__)
#define oci_stmt_error(w) _oci_error(S->err, stmt->dbh, stmt, w, S->last_err, FALSE, __FILE__, __LINE__)

/* Default prefetch size in number of rows */
#define PDO_OCI_PREFETCH_DEFAULT 100

/* Arbitrary assumed row length for prefetch memory limit calcuation */
#define PDO_OCI_PREFETCH_ROWSIZE 1024


enum {
PDO_OCI_ATTR_ACTION = PDO_ATTR_DRIVER_SPECIFIC,
PDO_OCI_ATTR_CLIENT_INFO,
PDO_OCI_ATTR_CLIENT_IDENTIFIER,
PDO_OCI_ATTR_MODULE,
PDO_OCI_ATTR_CALL_TIMEOUT
PDO_OCI_ATTR_ACTION = PDO_ATTR_DRIVER_SPECIFIC,
PDO_OCI_ATTR_CLIENT_INFO,
PDO_OCI_ATTR_CLIENT_IDENTIFIER,
PDO_OCI_ATTR_MODULE,
PDO_OCI_ATTR_CALL_TIMEOUT
};
Loading

0 comments on commit 97d5d54

Please sign in to comment.