@@ -1420,6 +1420,11 @@ PHP_REDIS_API int redis_sock_connect(RedisSock *redis_sock TSRMLS_DC)
14201420    int  host_len , usocket  =  0 , err  =  0 ;
14211421    php_netstream_data_t  * sock ;
14221422    int  tcp_flag  =  1 ;
1423+ #if  (PHP_MAJOR_VERSION  <  7 )
1424+     char  * estr  =  NULL ;
1425+ #else 
1426+     zend_string  * estr  =  NULL ;
1427+ #endif 
14231428
14241429    if  (redis_sock -> stream  !=  NULL ) {
14251430        redis_sock_disconnect (redis_sock  TSRMLS_CC );
@@ -1463,13 +1468,22 @@ PHP_REDIS_API int redis_sock_connect(RedisSock *redis_sock TSRMLS_DC)
14631468
14641469    redis_sock -> stream  =  php_stream_xport_create (host , host_len ,
14651470        0 , STREAM_XPORT_CLIENT  | STREAM_XPORT_CONNECT ,
1466-         persistent_id , tv_ptr , NULL , NULL , & err );
1471+         persistent_id , tv_ptr , NULL , & estr , & err );
14671472
14681473    if  (persistent_id ) {
14691474        efree (persistent_id );
14701475    }
14711476
14721477    if  (!redis_sock -> stream ) {
1478+         if  (estr ) {
1479+ #if  (PHP_MAJOR_VERSION  <  7 )
1480+             redis_sock_set_err (redis_sock , estr , strlen (estr ));
1481+             efree (estr );
1482+ #else 
1483+             redis_sock_set_err (redis_sock , ZSTR_VAL (estr ), ZSTR_LEN (estr ));
1484+             zend_string_release (estr );
1485+ #endif 
1486+         }
14731487        return  -1 ;
14741488    }
14751489
0 commit comments