RE: [PHP-CVS] com php-src: fix TS issues with url rewrite globals: ext/standard/basic_functions.c ext/standard/url_scanner_ex.c
ext/standard/url_scanner_ex.re
| From: | Anatol Belski | Date: | Sun, 21 Aug 2016 14:18:31 +0000 |
| Subject: | RE: [PHP-CVS] com php-src: fix TS issues with url rewrite globals: ext/standard/basic_functions.c ext/standard/url_scanner_ex.c ext/standard/url_scanner_ex.re |
||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-94027@lists.php.net to get a copy of this message | ||
Hi Yasuo,
> -----Original Message-----
> From: Anatol Belski [mailto:ab@php.net]
> Sent: Saturday, August 20, 2016 10:41 PM
> To: php-cvs@lists.php.net
> Subject: [PHP-CVS] com php-src: fix TS issues with url rewrite globals:
> ext/standard/basic_functions.c ext/standard/url_scanner_ex.c
> ext/standard/url_scanner_ex.re
>
> Commit: 872028de20b91e25428205f49fc036a09d4b001d
> Author: Anatol Belski <ab@php.net> Sat, 20 Aug 2016 22:39:14 +0200
> Parents: dfed09afcaed6773f00b366b0580a187f2fc453f
> Branches: PHP-7.1 master
>
> Link: http://git.php.net/?p=php-
> src.git;a=commitdiff;h=872028de20b91e25428205f49fc036a09d4b001d
>
> Log:
> fix TS issues with url rewrite globals
>
> Changed paths:
> M ext/standard/basic_functions.c
> M ext/standard/url_scanner_ex.c
> M ext/standard/url_scanner_ex.re
>
>
> Diff:
> diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
> index ef628cc..5463665 100644
> --- a/ext/standard/basic_functions.c
> +++ b/ext/standard/basic_functions.c
> @@ -3484,6 +3484,12 @@ static void basic_globals_ctor(php_basic_globals
> *basic_globals_p) /* {{{ */
> memset(&BG(url_adapt_session_ex), 0,
> sizeof(BG(url_adapt_session_ex)));
> memset(&BG(url_adapt_output_ex), 0,
> sizeof(BG(url_adapt_output_ex)));
>
> + BG(url_adapt_session_ex).type = 1;
> + BG(url_adapt_output_ex).type = 0;
> +
> + zend_hash_init(&BG(url_adapt_session_hosts_ht), 0, NULL, NULL, 1);
> + zend_hash_init(&BG(url_adapt_output_hosts_ht), 0, NULL, NULL, 1);
> +
> #if defined(_REENTRANT) && defined(HAVE_MBRLEN) &&
> defined(HAVE_MBSTATE_T)
> memset(&BG(mblen_state), 0, sizeof(BG(mblen_state))); #endif @@ -
> 3504,6 +3510,9 @@ static void basic_globals_dtor(php_basic_globals
> *basic_globals_p) /* {{{ */
> zend_hash_destroy(basic_globals_p-
> >url_adapt_output_ex.tags);
> free(basic_globals_p->url_adapt_output_ex.tags);
> }
> +
> + zend_hash_destroy(&basic_globals_p->url_adapt_session_hosts_ht);
> + zend_hash_destroy(&basic_globals_p->url_adapt_output_hosts_ht);
> }
> /* }}} */
>
> diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
> index 880332e..a798b5c 100644
> --- a/ext/standard/url_scanner_ex.c
> +++ b/ext/standard/url_scanner_ex.c
> @@ -1444,17 +1444,6 @@ PHPAPI int php_url_scanner_reset_var(zend_string
> *name, int encode)
>
> PHP_MINIT_FUNCTION(url_scanner)
> {
> - BG(url_adapt_session_ex).tags = NULL;
> - BG(url_adapt_session_ex).form_app.s =
> BG(url_adapt_session_ex).url_app.s = NULL;
> - zend_hash_init(&BG(url_adapt_session_hosts_ht), 0, NULL, NULL, 1);
> -
> - BG(url_adapt_output_ex).tags = NULL;
> - BG(url_adapt_output_ex).form_app.s =
> BG(url_adapt_output_ex).url_app.s = NULL;
> - zend_hash_init(&BG(url_adapt_output_hosts_ht), 0, NULL, NULL, 1);
> -
> - BG(url_adapt_session_ex).type = 1;
> - BG(url_adapt_output_ex).type = 0;
> -
> REGISTER_INI_ENTRIES();
> return SUCCESS;
> }
> diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
> index e0e74d0..2f84726 100644
> --- a/ext/standard/url_scanner_ex.re
> +++ b/ext/standard/url_scanner_ex.re
> @@ -962,17 +962,6 @@ PHPAPI int php_url_scanner_reset_var(zend_string
> *name, int encode)
>
> PHP_MINIT_FUNCTION(url_scanner)
> {
> - BG(url_adapt_session_ex).tags = NULL;
> - BG(url_adapt_session_ex).form_app.s =
> BG(url_adapt_session_ex).url_app.s = NULL;
> - zend_hash_init(&BG(url_adapt_session_hosts_ht), 0, NULL, NULL, 1);
> -
> - BG(url_adapt_output_ex).tags = NULL;
> - BG(url_adapt_output_ex).form_app.s =
> BG(url_adapt_output_ex).url_app.s = NULL;
> - zend_hash_init(&BG(url_adapt_output_hosts_ht), 0, NULL, NULL, 1);
> -
> - BG(url_adapt_session_ex).type = 1;
> - BG(url_adapt_output_ex).type = 0;
> -
> REGISTER_INI_ENTRIES();
> return SUCCESS;
> }
>
This fixes crashes with at least mpm_worker/mpm_winnt. Could you please verify?
I've also a question in this patch regard - what is the particular reason to put the session
related INI items into the basic globals?
Thanks
Anatol