From a7f5b9211601520abf94da668072b89dc7bcee73 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 12 Jan 2019 18:59:48 +0100 Subject: Fix missing symbol when there is no session support It's possible to build PHP with sessions as a module, or even without sessions at all. This commit make it possible to use Snuffleupagus on those platforms. --- src/sp_config_keywords.c | 12 ++++++++++++ src/sp_session.c | 8 ++++++++ 2 files changed, 20 insertions(+) (limited to 'src') diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index 04a3f41..760961a 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c @@ -40,6 +40,18 @@ int parse_session(char *line) { if (0 != ret) { return ret; } + +#if ( !HAVE_PHP_SESSION || defined(COMPILE_DL_SESSION) ) + sp_log_err("config", + "You're trying to use the session cookie encryption feature " + "on line %zu without having session support statically built into PHP. " + "This isn't supported, see " + "https://github.com/nbs-system/snuffleupagus/issues/278 for details.", + sp_line_no); + pefree(session, 0); + return -1; +#endif + if (session->encrypt) { if (0 == (SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var)) { sp_log_err( diff --git a/src/sp_session.c b/src/sp_session.c index 22b6688..25b5d85 100644 --- a/src/sp_session.c +++ b/src/sp_session.c @@ -3,6 +3,8 @@ ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus); +#if ( HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) ) + #ifdef ZTS static ts_rsrc_id session_globals_id = 0; #define SESSION_G(v) ZEND_TSRMG(session_globals_id, php_ps_globals *, v) @@ -160,3 +162,9 @@ void hook_session() { sp_hook_session_module(); } + +#else + +void hook_session() { } + +#endif // HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) -- cgit v1.3