@@ -50,7 +50,7 @@ PHP_METHOD(ClusterBuilder, build)
5050 php5to7_zend_resource_le * le ;
5151
5252 hash_key_len = spprintf (& hash_key , 0 ,
53- "cassandra:%s:%d:%d:%s:%d:%d:%d:%s:%s:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d" ,
53+ "cassandra:%s:%d:%d:%s:%d:%d:%d:%s:%s:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%s:%s:%s:%s " ,
5454 builder -> contact_points , builder -> port , builder -> load_balancing_policy ,
5555 SAFE_STR (builder -> local_dc ), builder -> used_hosts_per_remote_dc ,
5656 builder -> allow_remote_dcs_for_local_cl , builder -> use_token_aware_routing ,
@@ -60,7 +60,9 @@ PHP_METHOD(ClusterBuilder, build)
6060 builder -> core_connections_per_host , builder -> max_connections_per_host ,
6161 builder -> reconnect_interval , builder -> enable_latency_aware_routing ,
6262 builder -> enable_tcp_nodelay , builder -> enable_tcp_keepalive ,
63- builder -> tcp_keepalive_delay , builder -> enable_schema );
63+ builder -> tcp_keepalive_delay , builder -> enable_schema ,
64+ SAFE_STR (builder -> whitelist_hosts ), SAFE_STR (builder -> whitelist_dcs ),
65+ SAFE_STR (builder -> blacklist_hosts ), SAFE_STR (builder -> blacklist_dcs ));
6466
6567 cluster -> hash_key = hash_key ;
6668 cluster -> hash_key_len = hash_key_len ;
@@ -1144,29 +1146,29 @@ php_cassandra_cluster_builder_properties(zval *object TSRMLS_DC)
11441146 }
11451147
11461148 PHP5TO7_ZVAL_MAYBE_MAKE (blacklistHosts );
1147- if (! PHP5TO7_ZVAL_IS_UNDEF ( self -> blacklist_hosts ) ) {
1148- PHP5TO7_ZVAL_COPY (PHP5TO7_ZVAL_MAYBE_P (blacklistHosts ), PHP5TO7_ZVAL_MAYBE_P ( self -> blacklist_hosts ) );
1149+ if (self -> blacklist_hosts ) {
1150+ PHP5TO7_ZVAL_STRING (PHP5TO7_ZVAL_MAYBE_P (blacklistHosts ), self -> blacklist_hosts );
11491151 } else {
11501152 ZVAL_NULL (PHP5TO7_ZVAL_MAYBE_P (blacklistHosts ));
11511153 }
11521154
11531155 PHP5TO7_ZVAL_MAYBE_MAKE (whitelistHosts );
1154- if (! PHP5TO7_ZVAL_IS_UNDEF ( self -> whitelist_hosts ) ) {
1155- PHP5TO7_ZVAL_COPY (PHP5TO7_ZVAL_MAYBE_P (whitelistHosts ), PHP5TO7_ZVAL_MAYBE_P ( self -> whitelist_hosts ) );
1156+ if (self -> whitelist_hosts ) {
1157+ PHP5TO7_ZVAL_STRING (PHP5TO7_ZVAL_MAYBE_P (whitelistHosts ), self -> whitelist_hosts );
11561158 } else {
11571159 ZVAL_NULL (PHP5TO7_ZVAL_MAYBE_P (whitelistHosts ));
11581160 }
11591161
11601162 PHP5TO7_ZVAL_MAYBE_MAKE (blacklistDCs );
1161- if (! PHP5TO7_ZVAL_IS_UNDEF ( self -> blacklist_dcs ) ) {
1162- PHP5TO7_ZVAL_COPY (PHP5TO7_ZVAL_MAYBE_P (blacklistDCs ), PHP5TO7_ZVAL_MAYBE_P ( self -> blacklist_dcs ) );
1163+ if (self -> blacklist_dcs ) {
1164+ PHP5TO7_ZVAL_STRING (PHP5TO7_ZVAL_MAYBE_P (blacklistDCs ), self -> blacklist_dcs );
11631165 } else {
11641166 ZVAL_NULL (PHP5TO7_ZVAL_MAYBE_P (blacklistDCs ));
11651167 }
11661168
11671169 PHP5TO7_ZVAL_MAYBE_MAKE (whitelistDCs );
1168- if (! PHP5TO7_ZVAL_IS_UNDEF ( self -> whitelist_dcs ) ) {
1169- PHP5TO7_ZVAL_COPY (PHP5TO7_ZVAL_MAYBE_P (whitelistDCs ), PHP5TO7_ZVAL_MAYBE_P ( self -> whitelist_dcs ) );
1170+ if (self -> whitelist_dcs ) {
1171+ PHP5TO7_ZVAL_STRING (PHP5TO7_ZVAL_MAYBE_P (whitelistDCs ), self -> whitelist_dcs );
11701172 } else {
11711173 ZVAL_NULL (PHP5TO7_ZVAL_MAYBE_P (whitelistDCs ));
11721174 }
@@ -1278,6 +1280,26 @@ php_cassandra_cluster_builder_free(php5to7_zend_object_free *object TSRMLS_DC)
12781280 self -> password = NULL ;
12791281 }
12801282
1283+ if (self -> whitelist_hosts ) {
1284+ efree (self -> whitelist_hosts );
1285+ self -> whitelist_hosts = NULL ;
1286+ }
1287+
1288+ if (self -> blacklist_hosts ) {
1289+ efree (self -> blacklist_hosts );
1290+ self -> blacklist_hosts = NULL ;
1291+ }
1292+
1293+ if (self -> whitelist_dcs ) {
1294+ efree (self -> whitelist_dcs );
1295+ self -> whitelist_dcs = NULL ;
1296+ }
1297+
1298+ if (self -> blacklist_dcs ) {
1299+ efree (self -> blacklist_dcs );
1300+ self -> whitelist_dcs = NULL ;
1301+ }
1302+
12811303 PHP5TO7_ZVAL_MAYBE_DESTROY (self -> ssl_options );
12821304 PHP5TO7_ZVAL_MAYBE_DESTROY (self -> default_timeout );
12831305 PHP5TO7_ZVAL_MAYBE_DESTROY (self -> retry_policy );
0 commit comments