diff options
| author | jvoisin | 2019-01-12 18:59:48 +0100 |
|---|---|---|
| committer | jvoisin | 2019-01-12 18:59:48 +0100 |
| commit | a7f5b9211601520abf94da668072b89dc7bcee73 (patch) | |
| tree | 24ddd1dfd5febdb92e14cc66b7c9cd69e26af437 | |
| parent | 498340e928d4145620726aea249604e197724701 (diff) | |
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.
| -rw-r--r-- | src/sp_config_keywords.c | 12 | ||||
| -rw-r--r-- | src/sp_session.c | 8 |
2 files changed, 20 insertions, 0 deletions
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) { | |||
| 40 | if (0 != ret) { | 40 | if (0 != ret) { |
| 41 | return ret; | 41 | return ret; |
| 42 | } | 42 | } |
| 43 | |||
| 44 | #if ( !HAVE_PHP_SESSION || defined(COMPILE_DL_SESSION) ) | ||
| 45 | sp_log_err("config", | ||
| 46 | "You're trying to use the session cookie encryption feature " | ||
| 47 | "on line %zu without having session support statically built into PHP. " | ||
| 48 | "This isn't supported, see " | ||
| 49 | "https://github.com/nbs-system/snuffleupagus/issues/278 for details.", | ||
| 50 | sp_line_no); | ||
| 51 | pefree(session, 0); | ||
| 52 | return -1; | ||
| 53 | #endif | ||
| 54 | |||
| 43 | if (session->encrypt) { | 55 | if (session->encrypt) { |
| 44 | if (0 == (SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var)) { | 56 | if (0 == (SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var)) { |
| 45 | sp_log_err( | 57 | 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 @@ | |||
| 3 | 3 | ||
| 4 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus); | 4 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus); |
| 5 | 5 | ||
| 6 | #if ( HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) ) | ||
| 7 | |||
| 6 | #ifdef ZTS | 8 | #ifdef ZTS |
| 7 | static ts_rsrc_id session_globals_id = 0; | 9 | static ts_rsrc_id session_globals_id = 0; |
| 8 | #define SESSION_G(v) ZEND_TSRMG(session_globals_id, php_ps_globals *, v) | 10 | #define SESSION_G(v) ZEND_TSRMG(session_globals_id, php_ps_globals *, v) |
| @@ -160,3 +162,9 @@ void hook_session() { | |||
| 160 | 162 | ||
| 161 | sp_hook_session_module(); | 163 | sp_hook_session_module(); |
| 162 | } | 164 | } |
| 165 | |||
| 166 | #else | ||
| 167 | |||
| 168 | void hook_session() { } | ||
| 169 | |||
| 170 | #endif // HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) | ||
