com php-src: Second set of changes to mysqlnd for phpng. A bit problematic is that the streams seem not to be completely ported. Also there are some
hacks in the streams about EG(regular_list) and EG( persistent_list) and these need to be carefully checked. The test suite should catch them,
however.: ext/mysqlnd/mysqlnd_net.c ext/mysqlnd/ mysqlnd_priv.h ext/mysqlnd/mysqlnd_statistics.c
| From: | Andrey Hristov | Date: | Tue, 20 May 2014 18:50:15 +0000 |
| Subject: | com php-src: Second set of changes to mysqlnd for phpng. A bit problematic is that the streams seem not to be completely ported. Also there are some hacks in the streams about EG(regular_list) and EG( persistent_list) and these need to be carefully checked. The test suite should catch them, however.: ext/mysqlnd/mysqlnd_net.c ext/mysqlnd/ mysqlnd_priv.h ext/mysqlnd/mysqlnd_statistics.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78483@lists.php.net to get a copy of this message | ||
Commit: 5d4f9dfff40b3abc8c3b638541852ac1b602c308
Author: Andrey Hristov <andrey@php.net> Tue, 20 May 2014 21:50:15 +0300
Parents: 5d57e17a15cf89bf8b20d718ce5070b42ee446e0
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5d4f9dfff40b3abc8c3b638541852ac1b602c308
Log:
Second set of changes to mysqlnd for phpng.
A bit problematic is that the streams seem not to be completely ported.
Also there are some hacks in the streams about EG(regular_list) and EG(persistent_list)
and these need to be carefully checked. The test suite should catch them, however.
Changed paths:
M ext/mysqlnd/mysqlnd_net.c
M ext/mysqlnd/mysqlnd_priv.h
M ext/mysqlnd/mysqlnd_statistics.c
Diff:
diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c
index 226c855..4ec9aa4 100644
--- a/ext/mysqlnd/mysqlnd_net.c
+++ b/ext/mysqlnd/mysqlnd_net.c
@@ -133,7 +133,7 @@ MYSQLND_METHOD(mysqlnd_net, open_pipe)(MYSQLND_NET * const net, const char * con
unregistered yntil the script ends. So, we need to take care of that.
*/
net_stream->in_free = 1;
- zend_hash_index_del(&EG(regular_list), net_stream->rsrc_id);
+ zend_hash_index_del(&EG(regular_list), net_stream->res->handle); /* ToDO: should it be
res->handle, do streams register with addref ?*/
net_stream->in_free = 0;
@@ -198,16 +198,16 @@ MYSQLND_METHOD(mysqlnd_net, open_tcp_or_unix)(MYSQLND_NET * const net, const
cha
This is unwanted. ext/mysql or ext/mysqli are responsible to clean,
whatever they have to.
*/
- zend_rsrc_list_entry *le;
+ zend_resource *le;
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_len + 1, (void*)
&le) == SUCCESS) {
+ if ((le = zend_hash_str_find(&EG(persistent_list), hashed_details, hashed_details_len))) {
/*
in_free will let streams code skip destructing - big HACK,
but STREAMS suck big time regarding persistent streams.
Just not compatible for extensions that need persistency.
*/
net_stream->in_free = 1;
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_len + 1);
+ zend_hash_str_del(&EG(persistent_list), hashed_details, hashed_details_len);
net_stream->in_free = 0;
}
#if ZEND_DEBUG
@@ -223,7 +223,7 @@ MYSQLND_METHOD(mysqlnd_net, open_tcp_or_unix)(MYSQLND_NET * const net, const cha
unregistered yntil the script ends. So, we need to take care of that.
*/
net_stream->in_free = 1;
- zend_hash_index_del(&EG(regular_list), net_stream->rsrc_id);
+ zend_hash_index_del(&EG(regular_list), net_stream->res->handle); /* ToDO: should it be
res->handle, do streams register with addref ?*/
net_stream->in_free = 0;
DBG_RETURN(net_stream);
@@ -864,7 +864,7 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC)
if (net->data->options.ssl_key) {
zval key_zval;
- ZVAL_STRING(&key_zval, net->data->options.ssl_key, 0);
+ ZVAL_STRING(&key_zval, net->data->options.ssl_key);
php_stream_context_set_option(context, "ssl", "local_pk", &key_zval);
}
if (net->data->options.ssl_verify_peer) {
@@ -874,7 +874,7 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC)
}
if (net->data->options.ssl_cert) {
zval cert_zval;
- ZVAL_STRING(&cert_zval, net->data->options.ssl_cert, 0);
+ ZVAL_STRING(&cert_zval, net->data->options.ssl_cert);
php_stream_context_set_option(context, "ssl", "local_cert", &cert_zval);
if (!net->data->options.ssl_key) {
php_stream_context_set_option(context, "ssl", "local_pk", &cert_zval);
@@ -882,22 +882,22 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC)
}
if (net->data->options.ssl_ca) {
zval cafile_zval;
- ZVAL_STRING(&cafile_zval, net->data->options.ssl_ca, 0);
+ ZVAL_STRING(&cafile_zval, net->data->options.ssl_ca);
php_stream_context_set_option(context, "ssl", "cafile", &cafile_zval);
}
if (net->data->options.ssl_capath) {
zval capath_zval;
- ZVAL_STRING(&capath_zval, net->data->options.ssl_capath, 0);
+ ZVAL_STRING(&capath_zval, net->data->options.ssl_capath);
php_stream_context_set_option(context, "ssl", "cafile", &capath_zval);
}
if (net->data->options.ssl_passphrase) {
zval passphrase_zval;
- ZVAL_STRING(&passphrase_zval, net->data->options.ssl_passphrase, 0);
+ ZVAL_STRING(&passphrase_zval, net->data->options.ssl_passphrase);
php_stream_context_set_option(context, "ssl", "passphrase",
&passphrase_zval);
}
if (net->data->options.ssl_cipher) {
zval cipher_zval;
- ZVAL_STRING(&cipher_zval, net->data->options.ssl_cipher, 0);
+ ZVAL_STRING(&cipher_zval, net->data->options.ssl_cipher);
php_stream_context_set_option(context, "ssl", "ciphers", &cipher_zval);
}
#if PHP_API_VERSION >= 20131106
diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h
index a44e29d..536b37c 100644
--- a/ext/mysqlnd/mysqlnd_priv.h
+++ b/ext/mysqlnd/mysqlnd_priv.h
@@ -41,13 +41,6 @@
#define pestrndup(s, length, persistent)
((persistent)?zend_strndup((s),(length)):estrndup((s),(length)))
#endif
-#define mysqlnd_array_init(arg, field_count) \
-{ \
- ALLOC_HASHTABLE_REL(Z_ARRVAL_P(arg));\
- zend_hash_init(Z_ARRVAL_P(arg), (field_count), NULL, ZVAL_PTR_DTOR, 0); \
- Z_TYPE_P(arg) = IS_ARRAY;\
-}
-
#define MYSQLND_STR_W_LEN(str) str, (sizeof(str) - 1)
#define MYSQLND_DEBUG_DUMP_TIME 1
diff --git a/ext/mysqlnd/mysqlnd_statistics.c b/ext/mysqlnd/mysqlnd_statistics.c
index c6387e4..8b8eef6 100644
--- a/ext/mysqlnd/mysqlnd_statistics.c
+++ b/ext/mysqlnd/mysqlnd_statistics.c
@@ -201,7 +201,7 @@ mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, const MYSQLND_STRING
{
unsigned int i;
- mysqlnd_array_init(return_value, stats->count);
+ array_init_size(return_value, stats->count);
for (i = 0; i < stats->count; i++) {
char tmp[25];