summaryrefslogtreecommitdiff
path: root/lang/php85/files
diff options
context:
space:
mode:
Diffstat (limited to 'lang/php85/files')
-rw-r--r--lang/php85/files/patch-TSRM_TSRM.c11
-rw-r--r--lang/php85/files/patch-build_Makefile.global19
-rw-r--r--lang/php85/files/patch-configure.ac27
-rw-r--r--lang/php85/files/patch-ext_hash_xxhash_xxhash.h46
-rw-r--r--lang/php85/files/patch-ext_pcre_php__pcre.h11
-rw-r--r--lang/php85/files/patch-sapi_apache2handler_config.m411
-rw-r--r--lang/php85/files/patch-sapi_fpm_www.conf.in17
-rw-r--r--lang/php85/files/php_fpm.in102
-rw-r--r--lang/php85/files/php_session.h328
9 files changed, 572 insertions, 0 deletions
diff --git a/lang/php85/files/patch-TSRM_TSRM.c b/lang/php85/files/patch-TSRM_TSRM.c
new file mode 100644
index 000000000000..a5ad9dca4e8a
--- /dev/null
+++ b/lang/php85/files/patch-TSRM_TSRM.c
@@ -0,0 +1,11 @@
+--- TSRM/TSRM.c.orig 2024-07-02 13:43:13 UTC
++++ TSRM/TSRM.c
+@@ -792,7 +792,7 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
+ asm ("leal _tsrm_ls_cache@ntpoff,%0"
+ : "=r" (ret));
+ return ret;
+-#elif defined(__aarch64__)
++#elif defined(__aarch64__) && !defined(__FreeBSD__)
+ size_t ret;
+
+ # ifdef __APPLE__
diff --git a/lang/php85/files/patch-build_Makefile.global b/lang/php85/files/patch-build_Makefile.global
new file mode 100644
index 000000000000..52531a83dabe
--- /dev/null
+++ b/lang/php85/files/patch-build_Makefile.global
@@ -0,0 +1,19 @@
+--- build/Makefile.global.orig 2024-07-02 13:43:13 UTC
++++ build/Makefile.global
+@@ -91,14 +91,14 @@ test: all
+ @if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
+ INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
+ if test "$$INI_FILE"; then \
+- $(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
++ $(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_FILE" > $(top_builddir)/tmp-php.ini || :; \
+ else \
+ echo > $(top_builddir)/tmp-php.ini; \
+ fi; \
+ INI_SCANNED_PATH=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \
+ if test "$$INI_SCANNED_PATH"; then \
+ INI_SCANNED_PATH=`$(top_srcdir)/build/shtool path -d $$INI_SCANNED_PATH`; \
+- $(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \
++ $(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini || :; \
+ fi; \
+ TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
+ TEST_PHP_SRCDIR=$(top_srcdir) \
diff --git a/lang/php85/files/patch-configure.ac b/lang/php85/files/patch-configure.ac
new file mode 100644
index 000000000000..e9c038fd5b15
--- /dev/null
+++ b/lang/php85/files/patch-configure.ac
@@ -0,0 +1,27 @@
+--- configure.ac.orig 2024-09-10 16:10:06 UTC
++++ configure.ac
+@@ -55,6 +55,7 @@ AH_BOTTOM([
+
+ #include <string.h>
+
++#include <ext/php_config.h>
+ #endif /* PHP_CONFIG_H */
+ ])
+
+@@ -249,7 +250,6 @@ AS_VAR_APPEND([CPPFLAGS], [" -D_GNU_SOURCE"])
+ dnl require extensions to C and POSIX.
+ AS_VAR_APPEND([CPPFLAGS], [" -D_GNU_SOURCE"])
+
+-PTHREADS_CHECK
+ PHP_HELP_SEPARATOR([SAPI modules:])
+ PHP_SHLIB_SUFFIX_NAMES
+ PHP_BUILD_PROGRAM
+@@ -1368,7 +1368,7 @@ EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=$(eval echo "$PHP_CO
+ EXPANDED_DATADIR=$datadir
+ EXPANDED_PHP_CONFIG_FILE_PATH=$(eval echo "$PHP_CONFIG_FILE_PATH")
+ EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=$(eval echo "$PHP_CONFIG_FILE_SCAN_DIR")
+-INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
++INCLUDE_PATH=.:${prefix}/share/pear
+
+ exec_prefix=$old_exec_prefix
+ libdir=$old_libdir
diff --git a/lang/php85/files/patch-ext_hash_xxhash_xxhash.h b/lang/php85/files/patch-ext_hash_xxhash_xxhash.h
new file mode 100644
index 000000000000..d284f4c94f74
--- /dev/null
+++ b/lang/php85/files/patch-ext_hash_xxhash_xxhash.h
@@ -0,0 +1,46 @@
+--- ext/hash/xxhash/xxhash.h.orig 2023-06-06 15:54:29 UTC
++++ ext/hash/xxhash/xxhash.h
+@@ -3078,22 +3078,32 @@ enum XXH_VECTOR_TYPE /* fake enum */ {
+ * inconsistent intrinsics, spotty coverage, and multiple endiannesses.
+ */
+ #if XXH_VECTOR == XXH_VSX
++/* Annoyingly, these headers _may_ define three macros: `bool`, `vector`,
++ * and `pixel`. This is a problem for obvious reasons.
++ *
++ * These keywords are unnecessary; the spec literally says they are
++ * equivalent to `__bool`, `__vector`, and `__pixel` and may be undef'd
++ * after including the header.
++ *
++ * We use pragma push_macro/pop_macro to keep the namespace clean. */
++# pragma push_macro("bool")
++# pragma push_macro("vector")
++# pragma push_macro("pixel")
++/* silence potential macro redefined warnings */
++# undef bool
++# undef vector
++# undef pixel
++
+ # if defined(__s390x__)
+ # include <s390intrin.h>
+ # else
+-/* gcc's altivec.h can have the unwanted consequence to unconditionally
+- * #define bool, vector, and pixel keywords,
+- * with bad consequences for programs already using these keywords for other purposes.
+- * The paragraph defining these macros is skipped when __APPLE_ALTIVEC__ is defined.
+- * __APPLE_ALTIVEC__ is _generally_ defined automatically by the compiler,
+- * but it seems that, in some cases, it isn't.
+- * Force the build macro to be defined, so that keywords are not altered.
+- */
+-# if defined(__GNUC__) && !defined(__APPLE_ALTIVEC__)
+-# define __APPLE_ALTIVEC__
+-# endif
+ # include <altivec.h>
+ # endif
++
++/* Restore the original macro values, if applicable. */
++# pragma pop_macro("pixel")
++# pragma pop_macro("vector")
++# pragma pop_macro("bool")
+
+ typedef __vector unsigned long long xxh_u64x2;
+ typedef __vector unsigned char xxh_u8x16;
diff --git a/lang/php85/files/patch-ext_pcre_php__pcre.h b/lang/php85/files/patch-ext_pcre_php__pcre.h
new file mode 100644
index 000000000000..56c6dc75f6e3
--- /dev/null
+++ b/lang/php85/files/patch-ext_pcre_php__pcre.h
@@ -0,0 +1,11 @@
+--- ext/pcre/php_pcre.h.orig 2024-07-28 11:55:02 UTC
++++ ext/pcre/php_pcre.h
+@@ -20,7 +20,7 @@
+ #ifdef HAVE_BUNDLED_PCRE
+ #include "pcre2lib/pcre2.h"
+ #else
+-#include "pcre2.h"
++#include <pcre2.h>
+ #endif
+
+ #include <locale.h>
diff --git a/lang/php85/files/patch-sapi_apache2handler_config.m4 b/lang/php85/files/patch-sapi_apache2handler_config.m4
new file mode 100644
index 000000000000..cb9874a7a4b0
--- /dev/null
+++ b/lang/php85/files/patch-sapi_apache2handler_config.m4
@@ -0,0 +1,11 @@
+--- sapi/apache2handler/config.m4.orig 2024-08-27 14:33:48 UTC
++++ sapi/apache2handler/config.m4
+@@ -61,7 +61,7 @@ if test "$PHP_APXS2" != "no"; then
+ [AC_MSG_ERROR([Please note that Apache version >= 2.4 is required])])
+
+ APXS_LIBEXECDIR='$(INSTALL_ROOT)'$($APXS -q LIBEXECDIR)
+- if test -z $($APXS -q SYSCONFDIR); then
++ if true; then
+ INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
+ $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
+ -i -n php"
diff --git a/lang/php85/files/patch-sapi_fpm_www.conf.in b/lang/php85/files/patch-sapi_fpm_www.conf.in
new file mode 100644
index 000000000000..c7465018244d
--- /dev/null
+++ b/lang/php85/files/patch-sapi_fpm_www.conf.in
@@ -0,0 +1,17 @@
+--- sapi/fpm/www.conf.in.orig 2023-03-14 16:11:05 UTC
++++ sapi/fpm/www.conf.in
+@@ -32,10 +32,14 @@ group = @php_fpm_group@
+ ; Valid syntaxes are:
+ ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
+ ; a specific port;
++; '0.0.0.0:port' - to listen on a TCP socket to all IPv4 addresses on
++; a specific port;
+ ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
+ ; a specific port;
+ ; 'port' - to listen on a TCP socket to all addresses
+ ; (IPv6 and IPv4-mapped) on a specific port;
++; Note: IPv4-mapped addresses are disabled by-default in
++; FreeBSD for security reasons;
+ ; '/path/to/unix/socket' - to listen on a unix socket.
+ ; Note: This value is mandatory.
+ listen = 127.0.0.1:9000
diff --git a/lang/php85/files/php_fpm.in b/lang/php85/files/php_fpm.in
new file mode 100644
index 000000000000..d8a70275f453
--- /dev/null
+++ b/lang/php85/files/php_fpm.in
@@ -0,0 +1,102 @@
+#!/bin/sh
+
+# PROVIDE: php_fpm
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+#
+# Add the following line to /etc/rc.conf to enable php_fpm:
+# php_fpm_enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable php_fpm
+# php_fpm_profiles (str): Set to "" by default.
+# Define your profiles here.
+# php_fpm_pid_prefix (str): Set to "" by default.
+# When using profiles manually assign value to "php_fpm_"
+# for prevent collision with other PIDs names.
+
+. /etc/rc.subr
+
+name="php_fpm"
+rcvar=php_fpm_enable
+
+start_precmd="php_fpm_prestart"
+restart_precmd="php_fpm_checkconfig"
+reload_precmd="php_fpm_checkconfig"
+command="%%PREFIX%%/sbin/php-fpm"
+configtest_cmd="php_fpm_checkconfig"
+_pidprefix="/var/run"
+pidfile="${_pidprefix}/php-fpm.pid"
+required_files="%%PREFIX%%/etc/php-fpm.conf"
+
+load_rc_config "${name}"
+
+: ${php_fpm_enable="NO"}
+: ${php_fpm_umask=""}
+: ${php_fpm_svcj_options:="net_basic"}
+
+if [ -n "$2" ]; then
+ profile="$2"
+ if [ "x${php_fpm_profiles}" != "x" ]; then
+ pidfile="${_pidprefix}/${php_fpm_pid_prefix}php-fpm-${profile}.pid"
+ eval php_fpm_configfile="\${php_fpm_${profile}_configfile:-}"
+ if [ "x${php_fpm_configfile}" = "x" ]; then
+ echo "You must define a configuration file (php_fpm_${profile}_configfile)"
+ exit 1
+ fi
+ required_files="${php_fpm_configfile}"
+ eval php_fpm_enable="\${php_fpm_${profile}_enable:-${php_fpm_enable}}"
+ php_fpm_flags="-y ${php_fpm_configfile} -g ${pidfile}"
+ else
+ echo "$0: extra argument ignored"
+ fi
+else
+ if [ "x${php_fpm_profiles}" != "x" -a "x$1" != "x" ]; then
+ for profile in ${php_fpm_profiles}; do
+ echo "===> php_fpm profile: ${profile}"
+ %%PREFIX%%/etc/rc.d/php_fpm $1 ${profile}
+ retcode="$?"
+ if [ "0${retcode}" -ne 0 ]; then
+ failed="${profile} (${retcode}) ${failed:-}"
+ else
+ success="${profile} ${success:-}"
+ fi
+ done
+ exit 0
+ fi
+fi
+
+extra_commands="reload configtest logrotate"
+sig_stop="QUIT"
+sig_reload="USR2"
+logrotate_cmd="php_fpm_logrotate"
+
+php_fpm_logrotate() {
+ if [ -z "$rc_pid" ]; then
+ _run_rc_notrunning
+ return 1
+ fi
+ echo "Rotating logs $name."
+ kill -USR1 $rc_pid
+}
+
+php_fpm_checkconfig()
+{
+ echo "Performing sanity check on php-fpm configuration:"
+ eval ${command} ${php_fpm_flags} -t
+}
+
+php_fpm_prestart()
+{
+ php_fpm_checkconfig
+ checkconfig=$?
+ if [ $checkconfig -ne 0 ]; then
+ return $checkconfig
+ fi
+
+ if [ ! -z "$php_fpm_umask" ]; then
+ echo "Setting umask to: ${php_fpm_umask}"
+ umask $php_fpm_umask
+ fi
+}
+
+run_rc_command "$1"
diff --git a/lang/php85/files/php_session.h b/lang/php85/files/php_session.h
new file mode 100644
index 000000000000..65bf7de20449
--- /dev/null
+++ b/lang/php85/files/php_session.h
@@ -0,0 +1,328 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 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 |
+ | available through the world-wide-web at the following url: |
+ | https://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Sascha Schumann <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+ */
+
+#ifndef PHP_SESSION_H
+#define PHP_SESSION_H
+
+#include "ext/standard/php_var.h"
+#include "ext/random/php_random.h"
+
+#define PHP_SESSION_API 20161017
+
+#include "php_version.h"
+#define PHP_SESSION_VERSION PHP_VERSION
+
+/* save handler macros */
+#define PS_OPEN_ARGS void **mod_data, const char *save_path, const char *session_name
+#define PS_CLOSE_ARGS void **mod_data
+#define PS_READ_ARGS void **mod_data, zend_string *key, zend_string **val, zend_long maxlifetime
+#define PS_WRITE_ARGS void **mod_data, zend_string *key, zend_string *val, zend_long maxlifetime
+#define PS_DESTROY_ARGS void **mod_data, zend_string *key
+#define PS_GC_ARGS void **mod_data, zend_long maxlifetime, zend_long *nrdels
+#define PS_CREATE_SID_ARGS void **mod_data
+#define PS_VALIDATE_SID_ARGS void **mod_data, zend_string *key
+#define PS_UPDATE_TIMESTAMP_ARGS void **mod_data, zend_string *key, zend_string *val, zend_long maxlifetime
+
+typedef struct ps_module_struct {
+ const char *s_name;
+ zend_result (*s_open)(PS_OPEN_ARGS);
+ zend_result (*s_close)(PS_CLOSE_ARGS);
+ zend_result (*s_read)(PS_READ_ARGS);
+ zend_result (*s_write)(PS_WRITE_ARGS);
+ zend_result (*s_destroy)(PS_DESTROY_ARGS);
+ zend_long (*s_gc)(PS_GC_ARGS);
+ zend_string *(*s_create_sid)(PS_CREATE_SID_ARGS);
+ zend_result (*s_validate_sid)(PS_VALIDATE_SID_ARGS);
+ zend_result (*s_update_timestamp)(PS_UPDATE_TIMESTAMP_ARGS);
+} ps_module;
+
+#define PS_GET_MOD_DATA() *mod_data
+#define PS_SET_MOD_DATA(a) *mod_data = (a)
+
+#define PS_OPEN_FUNC(x) zend_result ps_open_##x(PS_OPEN_ARGS)
+#define PS_CLOSE_FUNC(x) zend_result ps_close_##x(PS_CLOSE_ARGS)
+#define PS_READ_FUNC(x) zend_result ps_read_##x(PS_READ_ARGS)
+#define PS_WRITE_FUNC(x) zend_result ps_write_##x(PS_WRITE_ARGS)
+#define PS_DESTROY_FUNC(x) zend_result ps_delete_##x(PS_DESTROY_ARGS)
+#define PS_GC_FUNC(x) zend_long ps_gc_##x(PS_GC_ARGS)
+#define PS_CREATE_SID_FUNC(x) zend_string *ps_create_sid_##x(PS_CREATE_SID_ARGS)
+#define PS_VALIDATE_SID_FUNC(x) zend_result ps_validate_sid_##x(PS_VALIDATE_SID_ARGS)
+#define PS_UPDATE_TIMESTAMP_FUNC(x) zend_result ps_update_timestamp_##x(PS_UPDATE_TIMESTAMP_ARGS)
+
+/* Legacy save handler module definitions */
+#define PS_FUNCS(x) \
+ PS_OPEN_FUNC(x); \
+ PS_CLOSE_FUNC(x); \
+ PS_READ_FUNC(x); \
+ PS_WRITE_FUNC(x); \
+ PS_DESTROY_FUNC(x); \
+ PS_GC_FUNC(x); \
+ PS_CREATE_SID_FUNC(x)
+
+#define PS_MOD(x) \
+ #x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
+ ps_delete_##x, ps_gc_##x, php_session_create_id, \
+ php_session_validate_sid, php_session_update_timestamp
+
+/* Legacy SID creation enabled save handler module definitions */
+#define PS_FUNCS_SID(x) \
+ PS_OPEN_FUNC(x); \
+ PS_CLOSE_FUNC(x); \
+ PS_READ_FUNC(x); \
+ PS_WRITE_FUNC(x); \
+ PS_DESTROY_FUNC(x); \
+ PS_GC_FUNC(x); \
+ PS_CREATE_SID_FUNC(x); \
+ PS_VALIDATE_SID_FUNC(x); \
+ PS_UPDATE_TIMESTAMP_FUNC(x);
+
+#define PS_MOD_SID(x) \
+ #x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
+ ps_delete_##x, ps_gc_##x, ps_create_sid_##x, \
+ php_session_validate_sid, php_session_update_timestamp
+
+/* Update timestamp enabled save handler module definitions
+ New save handlers should use this API */
+#define PS_FUNCS_UPDATE_TIMESTAMP(x) \
+ PS_OPEN_FUNC(x); \
+ PS_CLOSE_FUNC(x); \
+ PS_READ_FUNC(x); \
+ PS_WRITE_FUNC(x); \
+ PS_DESTROY_FUNC(x); \
+ PS_GC_FUNC(x); \
+ PS_CREATE_SID_FUNC(x); \
+ PS_VALIDATE_SID_FUNC(x); \
+ PS_UPDATE_TIMESTAMP_FUNC(x);
+
+#define PS_MOD_UPDATE_TIMESTAMP(x) \
+ #x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
+ ps_delete_##x, ps_gc_##x, ps_create_sid_##x, \
+ ps_validate_sid_##x, ps_update_timestamp_##x
+
+
+typedef enum {
+ php_session_disabled,
+ php_session_none,
+ php_session_active
+} php_session_status;
+
+typedef struct _php_session_rfc1867_progress {
+ size_t sname_len;
+ zval sid;
+ smart_str key;
+
+ zend_long update_step;
+ zend_long next_update;
+ double next_update_time;
+ bool cancel_upload;
+ bool apply_trans_sid;
+ size_t content_length;
+
+ zval data; /* the array exported to session data */
+ zval files; /* data["files"] array */
+ zval *post_bytes_processed; /* data["bytes_processed"] */
+ zval *current_file_bytes_processed;
+ zval current_file; /* array of currently uploading file */
+} php_session_rfc1867_progress;
+
+typedef struct _php_ps_globals {
+ char *save_path;
+ char *session_name;
+ zend_string *id;
+ char *extern_referer_chk;
+ char *cache_limiter;
+ zend_long cookie_lifetime;
+ char *cookie_path;
+ char *cookie_domain;
+ char *cookie_samesite;
+ bool cookie_secure;
+ bool cookie_httponly;
+ const ps_module *mod;
+ const ps_module *default_mod;
+ void *mod_data;
+ php_session_status session_status;
+ zend_string *session_started_filename;
+ uint32_t session_started_lineno;
+ int module_number;
+ php_random_status_state_pcgoneseq128xslrr64 random_state;
+ php_random_algo_with_state random;
+ zend_long gc_probability;
+ zend_long gc_divisor;
+ zend_long gc_maxlifetime;
+ zend_long cache_expire;
+ struct {
+ zval ps_open;
+ zval ps_close;
+ zval ps_read;
+ zval ps_write;
+ zval ps_destroy;
+ zval ps_gc;
+ zval ps_create_sid;
+ zval ps_validate_sid;
+ zval ps_update_timestamp;
+ } mod_user_names;
+ zend_string *mod_user_class_name;
+ bool mod_user_implemented;
+ bool mod_user_is_open;
+ bool auto_start;
+ bool use_cookies;
+ bool use_only_cookies;
+ bool use_trans_sid; /* contains the INI value of whether to use trans-sid */
+ bool send_cookie;
+ bool define_sid;
+
+ const struct ps_serializer_struct *serializer;
+ zval http_session_vars;
+
+ zend_long sid_length;
+ zend_long sid_bits_per_character;
+
+ php_session_rfc1867_progress *rfc1867_progress;
+ char *rfc1867_prefix; /* session.upload_progress.prefix */
+ char *rfc1867_name; /* session.upload_progress.name */
+ zend_long rfc1867_freq; /* session.upload_progress.freq */
+ double rfc1867_min_freq; /* session.upload_progress.min_freq */
+ bool rfc1867_enabled; /* session.upload_progress.enabled */
+ bool rfc1867_cleanup; /* session.upload_progress.cleanup */
+
+ bool use_strict_mode; /* whether or not PHP accepts unknown session ids */
+ bool lazy_write; /* omit session write when it is possible */
+ bool in_save_handler; /* state if session is in save handler or not */
+ bool set_handler; /* state if session module i setting handler or not */
+ zend_string *session_vars; /* serialized original session data */
+} php_ps_globals;
+
+typedef php_ps_globals zend_ps_globals;
+
+extern zend_module_entry session_module_entry;
+#define phpext_session_ptr &session_module_entry
+
+#ifdef ZTS
+#define PS(v) ZEND_TSRMG(ps_globals_id, php_ps_globals *, v)
+#ifdef COMPILE_DL_SESSION
+ZEND_TSRMLS_CACHE_EXTERN()
+#endif
+#else
+#define PS(v) (ps_globals.v)
+#endif
+
+#define PS_SERIALIZER_ENCODE_ARGS void
+#define PS_SERIALIZER_DECODE_ARGS const char *val, size_t vallen
+
+typedef struct ps_serializer_struct {
+ const char *name;
+ zend_string *(*encode)(PS_SERIALIZER_ENCODE_ARGS);
+ zend_result (*decode)(PS_SERIALIZER_DECODE_ARGS);
+} ps_serializer;
+
+#define PS_SERIALIZER_ENCODE_NAME(x) ps_srlzr_encode_##x
+#define PS_SERIALIZER_DECODE_NAME(x) ps_srlzr_decode_##x
+
+#define PS_SERIALIZER_ENCODE_FUNC(x) \
+ zend_string *PS_SERIALIZER_ENCODE_NAME(x)(PS_SERIALIZER_ENCODE_ARGS)
+#define PS_SERIALIZER_DECODE_FUNC(x) \
+ zend_result PS_SERIALIZER_DECODE_NAME(x)(PS_SERIALIZER_DECODE_ARGS)
+
+#define PS_SERIALIZER_FUNCS(x) \
+ PS_SERIALIZER_ENCODE_FUNC(x); \
+ PS_SERIALIZER_DECODE_FUNC(x)
+
+#define PS_SERIALIZER_ENTRY(x) \
+ { #x, PS_SERIALIZER_ENCODE_NAME(x), PS_SERIALIZER_DECODE_NAME(x) }
+
+/* default create id function */
+PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS);
+/* Dummy PS module functions */
+PHPAPI zend_result php_session_validate_sid(PS_VALIDATE_SID_ARGS);
+PHPAPI zend_result php_session_update_timestamp(PS_UPDATE_TIMESTAMP_ARGS);
+
+PHPAPI void session_adapt_url(const char *url, size_t url_len, char **new_url, size_t *new_len);
+
+PHPAPI zend_result php_session_destroy(void);
+PHPAPI void php_add_session_var(zend_string *name);
+PHPAPI zval *php_set_session_var(zend_string *name, zval *state_val, php_unserialize_data_t *var_hash);
+PHPAPI zval *php_get_session_var(zend_string *name);
+PHPAPI zval* php_get_session_var_str(const char *name, size_t name_len);
+
+PHPAPI zend_result php_session_register_module(const ps_module *);
+
+PHPAPI zend_result php_session_register_serializer(const char *name,
+ zend_string *(*encode)(PS_SERIALIZER_ENCODE_ARGS),
+ zend_result (*decode)(PS_SERIALIZER_DECODE_ARGS));
+
+PHPAPI zend_result php_session_start(void);
+PHPAPI zend_result php_session_flush(int write);
+PHPAPI php_session_status php_get_session_status(void);
+
+PHPAPI const ps_module *_php_find_ps_module(const char *name);
+PHPAPI const ps_serializer *_php_find_ps_serializer(const char *name);
+
+PHPAPI zend_result php_session_valid_key(const char *key);
+PHPAPI zend_result php_session_reset_id(void);
+
+#define PS_ADD_VARL(name) do { \
+ php_add_session_var(name); \
+} while (0)
+
+#define PS_ADD_VAR(name) PS_ADD_VARL(name)
+
+#define PS_DEL_VARL(name) do { \
+ if (!Z_ISNULL(PS(http_session_vars))) { \
+ zend_hash_del(Z_ARRVAL(PS(http_session_vars)), name); \
+ } \
+} while (0)
+
+
+#define PS_ENCODE_VARS \
+ zend_string *key; \
+ zend_ulong num_key; \
+ zval *struc;
+
+#define PS_ENCODE_LOOP(code) do { \
+ HashTable *_ht = Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))); \
+ ZEND_HASH_FOREACH_KEY(_ht, num_key, key) { \
+ if (key == NULL) { \
+ php_error_docref(NULL, E_WARNING, \
+ "Skipping numeric key " ZEND_LONG_FMT, num_key);\
+ continue; \
+ } \
+ if ((struc = php_get_session_var(key))) { \
+ code; \
+ } \
+ } ZEND_HASH_FOREACH_END(); \
+} while(0)
+
+PHPAPI ZEND_EXTERN_MODULE_GLOBALS(ps)
+
+void php_session_auto_start(void *data);
+
+extern PHPAPI zend_class_entry *php_session_class_entry;
+
+extern PHPAPI zend_class_entry *php_session_iface_entry;
+
+extern PHPAPI zend_class_entry *php_session_id_iface_entry;
+
+extern PHPAPI zend_class_entry *php_session_update_timestamp_iface_entry;
+
+extern PHP_METHOD(SessionHandler, open);
+extern PHP_METHOD(SessionHandler, close);
+extern PHP_METHOD(SessionHandler, read);
+extern PHP_METHOD(SessionHandler, write);
+extern PHP_METHOD(SessionHandler, destroy);
+extern PHP_METHOD(SessionHandler, gc);
+extern PHP_METHOD(SessionHandler, create_sid);
+
+#endif