@@ -125,11 +125,17 @@ PHP_METHOD(SSLOptionsBuilder, withTrustedCerts)
125125 PHP5TO7_MAYBE_EFREE (args );
126126 }
127127
128+ #if PHP_VERSION_ID < 80100
128129 php_stat (Z_STRVAL_P (path ), Z_STRLEN_P (path ), FS_IS_R , & readable TSRMLS_CC );
130+ #else
131+ zend_string * path_str = zend_string_init (Z_STRVAL_P (path ), Z_STRLEN_P (path ), false);
132+ php_stat (path_str , FS_IS_R , & readable TSRMLS_CC );
133+ zend_string_release (path_str );
134+ #endif
129135
130136 if (PHP5TO7_ZVAL_IS_FALSE_P (& readable )) {
131137 zend_throw_exception_ex (php_driver_invalid_argument_exception_ce , 0 TSRMLS_CC ,
132- "The path '%s' doesn't exist or is not readable" , Z_STRVAL_P (path ));
138+ "The path '%s' doesn't exist or is not readable" , Z_STRVAL_P (path ));
133139 PHP5TO7_MAYBE_EFREE (args );
134140 return ;
135141 }
@@ -146,10 +152,10 @@ PHP_METHOD(SSLOptionsBuilder, withTrustedCerts)
146152 }
147153
148154 builder -> trusted_certs_cnt = argc ;
149- builder -> trusted_certs = ecalloc (argc , sizeof (char * ));
155+ builder -> trusted_certs = ecalloc (argc , sizeof (char * ));
150156
151157 for (i = 0 ; i < argc ; i ++ ) {
152- zval * path = PHP5TO7_ZVAL_ARG (args [i ]);
158+ zval * path = PHP5TO7_ZVAL_ARG (args [i ]);
153159
154160 builder -> trusted_certs [i ] = estrndup (Z_STRVAL_P (path ), Z_STRLEN_P (path ));
155161 }
@@ -161,7 +167,7 @@ PHP_METHOD(SSLOptionsBuilder, withTrustedCerts)
161167PHP_METHOD (SSLOptionsBuilder , withVerifyFlags )
162168{
163169 long flags ;
164- php_driver_ssl_builder * builder = NULL ;
170+ php_driver_ssl_builder * builder = NULL ;
165171
166172 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "l" , & flags ) == FAILURE ) {
167173 return ;
@@ -176,20 +182,26 @@ PHP_METHOD(SSLOptionsBuilder, withVerifyFlags)
176182
177183PHP_METHOD (SSLOptionsBuilder , withClientCert )
178184{
179- char * client_cert ;
185+ char * client_cert ;
180186 php5to7_size client_cert_len ;
181187 zval readable ;
182- php_driver_ssl_builder * builder = NULL ;
188+ php_driver_ssl_builder * builder = NULL ;
183189
184190 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "s" , & client_cert , & client_cert_len ) == FAILURE ) {
185191 return ;
186192 }
187193
194+ #if PHP_VERSION_ID < 80100
188195 php_stat (client_cert , client_cert_len , FS_IS_R , & readable TSRMLS_CC );
196+ #else
197+ zend_string * client_cert_str = zend_string_init (client_cert , client_cert_len , false);
198+ php_stat (client_cert_str , FS_IS_R , & readable TSRMLS_CC );
199+ zend_string_release (client_cert_str );
200+ #endif
189201
190202 if (PHP5TO7_ZVAL_IS_FALSE_P (& readable )) {
191203 zend_throw_exception_ex (php_driver_invalid_argument_exception_ce , 0 TSRMLS_CC ,
192- "The path '%s' doesn't exist or is not readable" , client_cert );
204+ "The path '%s' doesn't exist or is not readable" , client_cert );
193205 return ;
194206 }
195207
@@ -205,17 +217,23 @@ PHP_METHOD(SSLOptionsBuilder, withClientCert)
205217
206218PHP_METHOD (SSLOptionsBuilder , withPrivateKey )
207219{
208- char * private_key ;
209- char * passphrase = NULL ;
220+ char * private_key ;
221+ char * passphrase = NULL ;
210222 php5to7_size private_key_len , passphrase_len ;
211223 zval readable ;
212- php_driver_ssl_builder * builder = NULL ;
224+ php_driver_ssl_builder * builder = NULL ;
213225
214226 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "s|s" , & private_key , & private_key_len , & passphrase , & passphrase_len ) == FAILURE ) {
215227 return ;
216228 }
217229
230+ #if PHP_VERSION_ID < 80100
218231 php_stat (private_key , private_key_len , FS_IS_R , & readable TSRMLS_CC );
232+ #else
233+ zend_string * private_key_str = zend_string_init (private_key , private_key_len , false);
234+ php_stat (private_key_str , FS_IS_R , & readable TSRMLS_CC );
235+ zend_string_release (private_key_str );
236+ #endif
219237
220238 if (PHP5TO7_ZVAL_IS_FALSE_P (& readable )) {
221239 zend_throw_exception_ex (php_driver_invalid_argument_exception_ce , 0 TSRMLS_CC ,
0 commit comments