helly Fri May 30 11:07:02 2003 EDT Modified files: /php4/ext/pgsql pgsql.c php_pgsql.h /php4/ext/pgsql/tests 09notice.phpt Log: - Fix ini handling in ZTS mode Index: php4/ext/pgsql/pgsql.c diff -u php4/ext/pgsql/pgsql.c:1.271 php4/ext/pgsql/pgsql.c:1.272 --- php4/ext/pgsql/pgsql.c:1.271 Fri Apr 25 17:59:58 2003 +++ php4/ext/pgsql/pgsql.c Fri May 30 11:07:01 2003 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.271 2003/04/25 21:59:58 iliaa Exp $ */ +/* $Id: pgsql.c,v 1.272 2003/05/30 15:07:01 helly Exp $ */ #include <stdlib.h> @@ -212,11 +212,7 @@ static int le_link, le_plink, le_result, le_lofp, le_string; -#ifdef ZTS -int pgsql_globals_id; -#else -php_pgsql_globals pgsql_globals; -#endif +ZEND_DECLARE_MODULE_GLOBALS(pgsql); /* {{{ php_pgsql_set_default_link */ @@ -348,22 +344,22 @@ /* {{{ PHP_INI */ PHP_INI_BEGIN() -STD_PHP_INI_BOOLEAN("pgsql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_persistent, php_pgsql_globals, pgsql_globals) -STD_PHP_INI_ENTRY_EX("pgsql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, php_pgsql_globals, pgsql_globals, display_link_numbers) -STD_PHP_INI_ENTRY_EX("pgsql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, php_pgsql_globals, pgsql_globals, display_link_numbers) -STD_PHP_INI_BOOLEAN("pgsql.auto_reset_persistent", "0", PHP_INI_SYSTEM, OnUpdateBool, auto_reset_persistent, php_pgsql_globals, pgsql_globals) -STD_PHP_INI_BOOLEAN("pgsql.ignore_notice", "0", PHP_INI_ALL, OnUpdateBool, ignore_notices, php_pgsql_globals, pgsql_globals) -STD_PHP_INI_BOOLEAN("pgsql.log_notice", "0", PHP_INI_ALL, OnUpdateBool, log_notices, php_pgsql_globals, pgsql_globals) +STD_PHP_INI_BOOLEAN( "pgsql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_persistent, zend_pgsql_globals, pgsql_globals) +STD_PHP_INI_ENTRY_EX("pgsql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, zend_pgsql_globals, pgsql_globals, display_link_numbers) +STD_PHP_INI_ENTRY_EX("pgsql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_pgsql_globals, pgsql_globals, display_link_numbers) +STD_PHP_INI_BOOLEAN( "pgsql.auto_reset_persistent", "0", PHP_INI_SYSTEM, OnUpdateBool, auto_reset_persistent, zend_pgsql_globals, pgsql_globals) +STD_PHP_INI_BOOLEAN( "pgsql.ignore_notice", "0", PHP_INI_ALL, OnUpdateBool, ignore_notices, zend_pgsql_globals, pgsql_globals) +STD_PHP_INI_BOOLEAN( "pgsql.log_notice", "0", PHP_INI_ALL, OnUpdateBool, log_notices, zend_pgsql_globals, pgsql_globals) PHP_INI_END() /* }}} */ /* {{{ php_pgsql_init_globals */ -static void php_pgsql_init_globals(php_pgsql_globals *pgsql_globals_p TSRMLS_DC) +static void php_pgsql_init_globals(zend_pgsql_globals *pgsql_globals) { - PGG(num_persistent) = 0; + memset(pgsql_globals, 0, sizeof(zend_pgsql_globals)); /* Initilize notice message hash at MINIT only */ - zend_hash_init_ex(&PGG(notices), 0, NULL, PHP_PGSQL_NOTICE_PTR_DTOR, 1, 0); + zend_hash_init_ex(&pgsql_globals->notices, 0, NULL, PHP_PGSQL_NOTICE_PTR_DTOR, 1, 0); } /* }}} */ @@ -371,11 +367,7 @@ */ PHP_MINIT_FUNCTION(pgsql) { -#ifdef ZTS - ts_allocate_id(&pgsql_globals_id, sizeof(php_pgsql_globals), (ts_allocate_ctor) php_pgsql_init_globals, NULL); -#else - php_pgsql_init_globals(&pgsql_globals TSRMLS_CC); -#endif + ZEND_INIT_MODULE_GLOBALS(pgsql, php_pgsql_init_globals, NULL); REGISTER_INI_ENTRIES(); Index: php4/ext/pgsql/php_pgsql.h diff -u php4/ext/pgsql/php_pgsql.h:1.60 php4/ext/pgsql/php_pgsql.h:1.61 --- php4/ext/pgsql/php_pgsql.h:1.60 Tue Apr 1 18:56:16 2003 +++ php4/ext/pgsql/php_pgsql.h Fri May 30 11:07:02 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pgsql.h,v 1.60 2003/04/01 23:56:16 jay Exp $ */ +/* $Id: php_pgsql.h,v 1.61 2003/05/30 15:07:02 helly Exp $ */ #ifndef PHP_PGSQL_H #define PHP_PGSQL_H @@ -236,7 +236,7 @@ size_t len; } php_pgsql_notice; -typedef struct { +ZEND_BEGIN_MODULE_GLOBALS(pgsql) long default_link; /* default link when connection is omitted */ long num_links,num_persistent; long max_links,max_persistent; @@ -245,15 +245,14 @@ int le_lofp,le_string; int ignore_notices,log_notices; HashTable notices; /* notice message for each connection */ -} php_pgsql_globals; +ZEND_END_MODULE_GLOBALS(pgsql) +ZEND_EXTERN_MODULE_GLOBALS(pgsql) #ifdef ZTS -# define PGG(v) TSRMG(pgsql_globals_id, php_pgsql_globals *, v) -extern int pgsql_globals_id; +# define PGG(v) TSRMG(pgsql_globals_id, zend_pgsql_globals *, v) #else # define PGG(v) (pgsql_globals.v) -extern php_pgsql_globals pgsql_globals; #endif #endif Index: php4/ext/pgsql/tests/09notice.phpt diff -u php4/ext/pgsql/tests/09notice.phpt:1.3 php4/ext/pgsql/tests/09notice.phpt:1.4 --- php4/ext/pgsql/tests/09notice.phpt:1.3 Mon May 19 20:14:46 2003 +++ php4/ext/pgsql/tests/09notice.phpt Fri May 30 11:07:02 2003 @@ -2,11 +2,12 @@ PostgreSQL notice function --SKIPIF-- <?php include("skipif.inc"); ?> +--INI-- +pgsql.log_notice=1 +pgsql.ignore_notices=0 --FILE-- <?php include 'config.inc'; - -ini_set('pgsql.log_notice',1); $db = pg_connect($conn_str); pg_query($db, "BEGIN;");
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php