summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Fuhrmannek2016-03-04 11:34:33 +0100
committerBen Fuhrmannek2016-03-04 11:34:33 +0100
commit3d8cc07c5af283289f62f0964f153804f2cc1862 (patch)
tree048e15e05ffd080fa1ad6752b0e893c62e83716e
parent60ba43075649da201339634ed071ccb274c96ec8 (diff)
fixed ZTS segfault (closes #4)
-rw-r--r--php_suhosin7.h13
-rw-r--r--suhosin7.c14
2 files changed, 17 insertions, 10 deletions
diff --git a/php_suhosin7.h b/php_suhosin7.h
index 5024790..cbde402 100644
--- a/php_suhosin7.h
+++ b/php_suhosin7.h
@@ -37,6 +37,9 @@ extern zend_module_entry suhosin7_module_entry;
37# define SUHOSIN7_API 37# define SUHOSIN7_API
38#endif 38#endif
39 39
40#ifdef ZTS
41#include "TSRM.h"
42#endif
40 43
41/* -------------- */ 44/* -------------- */
42 45
@@ -323,12 +326,12 @@ ZEND_BEGIN_MODULE_GLOBALS(suhosin7)
323 326
324ZEND_END_MODULE_GLOBALS(suhosin7) 327ZEND_END_MODULE_GLOBALS(suhosin7)
325 328
326/* Always refer to the globals in your function as SUHOSIN7_G(variable).
327 You are encouraged to rename these macros something shorter, see
328 examples in any other php module directory.
329*/
330#define SUHOSIN7_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(suhosin7, v) 329#define SUHOSIN7_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(suhosin7, v)
331 330
331#if defined(ZTS) && defined(COMPILE_DL_SUHOSIN7)
332ZEND_TSRMLS_CACHE_EXTERN();
333#endif
334
332 335
333/* Error Constants */ 336/* Error Constants */
334#ifndef S_MEMORY 337#ifndef S_MEMORY
@@ -417,8 +420,6 @@ char *suhosin_strcasestr(char *haystack, char *needle)
417#define suhosin_strcasestr(a, b) strcasestr(a, b) 420#define suhosin_strcasestr(a, b) strcasestr(a, b)
418#endif 421#endif
419 422
420/* {{{ suhosin_strcasestr */
421
422 423
423/* 424/*
424 * Local variables: 425 * Local variables:
diff --git a/suhosin7.c b/suhosin7.c
index 42a058f..14b7fa0 100644
--- a/suhosin7.c
+++ b/suhosin7.c
@@ -27,17 +27,14 @@
27#include "php.h" 27#include "php.h"
28#include "php_ini.h" 28#include "php_ini.h"
29#include "SAPI.h" 29#include "SAPI.h"
30#include "php_suhosin7.h"
31#include "suhosin7_logo.h" 30#include "suhosin7_logo.h"
32#include "ext/standard/base64.h" 31#include "ext/standard/base64.h"
33#include "ext/standard/info.h" 32#include "ext/standard/info.h"
33#include "php_suhosin7.h"
34 34
35 35
36ZEND_DECLARE_MODULE_GLOBALS(suhosin7) 36ZEND_DECLARE_MODULE_GLOBALS(suhosin7)
37 37
38/* True global resources - no need for thread safety here */
39// static int le_suhosin7;
40
41/* ------------------------------------------------------------------------ */ 38/* ------------------------------------------------------------------------ */
42/* PERDIR CHECKS */ 39/* PERDIR CHECKS */
43#define PERDIR_CHECK(lower) \ 40#define PERDIR_CHECK(lower) \
@@ -449,6 +446,11 @@ char *suhosin_getenv(char *name, size_t name_len)
449 */ 446 */
450static void php_suhosin7_init_globals(zend_suhosin7_globals *suhosin7_globals) 447static void php_suhosin7_init_globals(zend_suhosin7_globals *suhosin7_globals)
451{ 448{
449 SDEBUG(".");
450#if defined(COMPILE_DL_SUHOSIN7) && defined(ZTS)
451 ZEND_TSRMLS_CACHE_UPDATE();
452#endif
453
452 memset(suhosin7_globals, 0, sizeof(zend_suhosin7_globals)); 454 memset(suhosin7_globals, 0, sizeof(zend_suhosin7_globals));
453} 455}
454/* }}} */ 456/* }}} */
@@ -540,6 +542,10 @@ PHP_MSHUTDOWN_FUNCTION(suhosin7)
540PHP_RINIT_FUNCTION(suhosin7) 542PHP_RINIT_FUNCTION(suhosin7)
541{ 543{
542 SDEBUG("(RINIT)"); 544 SDEBUG("(RINIT)");
545#if defined(COMPILE_DL_SUHOSIN7) && defined(ZTS)
546 ZEND_TSRMLS_CACHE_UPDATE();
547#endif
548
543 SUHOSIN7_G(in_code_type) = SUHOSIN_NORMAL; 549 SUHOSIN7_G(in_code_type) = SUHOSIN_NORMAL;
544 SUHOSIN7_G(execution_depth) = 0; 550 SUHOSIN7_G(execution_depth) = 0;
545 551