]> granicus.if.org Git - php/commitdiff
* HTTP-auth bugfix
authorZeev Suraski <zeev@php.net>
Thu, 13 May 1999 15:54:49 +0000 (15:54 +0000)
committerZeev Suraski <zeev@php.net>
Thu, 13 May 1999 15:54:49 +0000 (15:54 +0000)
* Patch the regex thread safe code to compile in thread safe mode

ext/ereg/ereg.c
ext/ereg/php_ereg.h
ext/standard/reg.c
ext/standard/reg.h
main/main.c

index b492865e6b34191a276d5fa3e5959ab80ef592fd..e7550db08df17ff937cc8845ba77da662a5b76a0 100644 (file)
@@ -75,10 +75,10 @@ typedef struct {
 
 static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
 {
-       REGSLS_FETCH
        int r = 0;
        int patlen = strlen(pattern);
        reg_cache *rc = NULL;
+       REGLS_FETCH();
        
        if(_php3_hash_find(&REG(ht_rc), (char *) pattern, patlen, (void **) &rc) == FAILURE ||
                        rc->cflags != cflags) {
@@ -114,7 +114,7 @@ static void php_reg_init_globals(php_reg_globals *reg_globals)
 static int php_minit_regex(INIT_FUNC_ARGS)
 {
 #ifdef ZTS
-       reg_globals_id = tsrm_allocate_id(sizeof(php_reg_globals), php_reg_init_globals, NULL);
+       reg_globals_id = ts_allocate_id(sizeof(php_reg_globals), php_reg_init_globals, NULL);
 #else
        php_reg_init_globals(&reg_globals);
 #endif
@@ -124,6 +124,8 @@ static int php_minit_regex(INIT_FUNC_ARGS)
 
 static int php_mshutdown_regex(SHUTDOWN_FUNC_ARGS)
 {
+       REGLS_FETCH();
+
        _php3_hash_destroy(&REG(ht_rc));
        return SUCCESS;
 }
index 011484bc4f2c4227fea5c9dc2353026cc21c6ff5..4b7f37466dd6cf01930893d7d186a8cca11ce29e 100644 (file)
@@ -43,7 +43,7 @@ PHP_FUNCTION(eregi);
 PHP_FUNCTION(eregireplace);
 PHP_FUNCTION(eregreplace);
 PHP_FUNCTION(split);
-PHP_FUNCTION(sql_regcase);
+PHPAPI PHP_FUNCTION(sql_regcase);
 
 typedef struct {
        HashTable ht_rc;
@@ -51,19 +51,19 @@ typedef struct {
 
 
 #ifdef ZTS
-#define REGSLS_D php_reg_globals *reg_globals
-#define REGSLS_DC , REGSLS_D
-#define REGSLS_C reg_globals
-#define REGSLS_CC , REGSLS_C
+#define REGLS_D php_reg_globals *reg_globals
+#define REGLS_DC , REGLS_D
+#define REGLS_C reg_globals
+#define REGLS_CC , REGLS_C
 #define REG(v) (reg_globals->v)
-#define REGSLS_FETCH php_reg_globals *reg_globals = ts_resource(reg_globals_id);
+#define REGLS_FETCH() php_reg_globals *reg_globals = ts_resource(reg_globals_id)
 #else
-#define REGSLS_D
-#define REGSLS_DC
-#define REGSLS_C
-#define REGSLS_CC
+#define REGLS_D
+#define REGLS_DC
+#define REGLS_C
+#define REGLS_CC
 #define REG(v) (reg_globals.v)
-#define REGSLS_FETCH
+#define REGLS_FETCH()
 #endif
 
 #define phpext_regex_ptr regexp_module_ptr
index b492865e6b34191a276d5fa3e5959ab80ef592fd..e7550db08df17ff937cc8845ba77da662a5b76a0 100644 (file)
@@ -75,10 +75,10 @@ typedef struct {
 
 static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
 {
-       REGSLS_FETCH
        int r = 0;
        int patlen = strlen(pattern);
        reg_cache *rc = NULL;
+       REGLS_FETCH();
        
        if(_php3_hash_find(&REG(ht_rc), (char *) pattern, patlen, (void **) &rc) == FAILURE ||
                        rc->cflags != cflags) {
@@ -114,7 +114,7 @@ static void php_reg_init_globals(php_reg_globals *reg_globals)
 static int php_minit_regex(INIT_FUNC_ARGS)
 {
 #ifdef ZTS
-       reg_globals_id = tsrm_allocate_id(sizeof(php_reg_globals), php_reg_init_globals, NULL);
+       reg_globals_id = ts_allocate_id(sizeof(php_reg_globals), php_reg_init_globals, NULL);
 #else
        php_reg_init_globals(&reg_globals);
 #endif
@@ -124,6 +124,8 @@ static int php_minit_regex(INIT_FUNC_ARGS)
 
 static int php_mshutdown_regex(SHUTDOWN_FUNC_ARGS)
 {
+       REGLS_FETCH();
+
        _php3_hash_destroy(&REG(ht_rc));
        return SUCCESS;
 }
index 011484bc4f2c4227fea5c9dc2353026cc21c6ff5..4b7f37466dd6cf01930893d7d186a8cca11ce29e 100644 (file)
@@ -43,7 +43,7 @@ PHP_FUNCTION(eregi);
 PHP_FUNCTION(eregireplace);
 PHP_FUNCTION(eregreplace);
 PHP_FUNCTION(split);
-PHP_FUNCTION(sql_regcase);
+PHPAPI PHP_FUNCTION(sql_regcase);
 
 typedef struct {
        HashTable ht_rc;
@@ -51,19 +51,19 @@ typedef struct {
 
 
 #ifdef ZTS
-#define REGSLS_D php_reg_globals *reg_globals
-#define REGSLS_DC , REGSLS_D
-#define REGSLS_C reg_globals
-#define REGSLS_CC , REGSLS_C
+#define REGLS_D php_reg_globals *reg_globals
+#define REGLS_DC , REGLS_D
+#define REGLS_C reg_globals
+#define REGLS_CC , REGLS_C
 #define REG(v) (reg_globals->v)
-#define REGSLS_FETCH php_reg_globals *reg_globals = ts_resource(reg_globals_id);
+#define REGLS_FETCH() php_reg_globals *reg_globals = ts_resource(reg_globals_id)
 #else
-#define REGSLS_D
-#define REGSLS_DC
-#define REGSLS_C
-#define REGSLS_CC
+#define REGLS_D
+#define REGLS_DC
+#define REGLS_C
+#define REGLS_CC
 #define REG(v) (reg_globals.v)
-#define REGSLS_FETCH
+#define REGLS_FETCH()
 #endif
 
 #define phpext_regex_ptr regexp_module_ptr
index 0b9d086fa76e15b70c5cf71ec697541e76aecf62..ebe19538777810ae1b7c1b37eca2620c085f01bc 100644 (file)
@@ -639,7 +639,7 @@ int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC)
 
                zend_hash_update(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), &auth_user, sizeof(zval *), NULL);
        }
-       if (SG(request_info).auth_user) {
+       if (SG(request_info).auth_password) {
                zval *auth_password;
 
                MAKE_STD_ZVAL(auth_password);