svn: /php/php-src/ branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c trunk/ext/mysqlnd/mysqlnd_net.c
| From: | Andrey Hristov | Date: | Thu, 06 Oct 2011 00:45:58 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c trunk/ext/mysqlnd/mysqlnd_net.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-66698@lists.php.net to get a copy of this message | ||
andrey Thu, 06 Oct 2011 00:45:58 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=317815
Log:
try not to crash when closing persistent sockets, because EG(persistent_list)
is cleaned before the extensions' MSHUTDOWNs are called.
Changed paths:
U php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c
U php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c 2011-10-06 00:24:01 UTC (rev 317814)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c 2011-10-06 00:45:58 UTC (rev 317815)
@@ -932,7 +932,15 @@
if (net->stream) {
DBG_INF_FMT("Freeing stream. abstract=%p", net->stream->abstract);
if (pers) {
- php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE_PERSISTENT | PHP_STREAM_FREE_RSRC_DTOR);
+ if (EG(active)) {
+ php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE_PERSISTENT | PHP_STREAM_FREE_RSRC_DTOR);
+ } else {
+ /*
+ otherwise we will crash because the EG(persistent_list) has been freed already,
+ before the modules are shut down
+ */
+ php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR);
+ }
} else {
php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE);
}
Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2011-10-06 00:24:01 UTC (rev 317814)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2011-10-06 00:45:58 UTC (rev 317815)
@@ -932,7 +932,15 @@
if (net->stream) {
DBG_INF_FMT("Freeing stream. abstract=%p", net->stream->abstract);
if (pers) {
- php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE_PERSISTENT | PHP_STREAM_FREE_RSRC_DTOR);
+ if (EG(active)) {
+ php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE_PERSISTENT | PHP_STREAM_FREE_RSRC_DTOR);
+ } else {
+ /*
+ otherwise we will crash because the EG(persistent_list) has been freed already,
+ before the modules are shut down
+ */
+ php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR);
+ }
} else {
php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE);
}