[PECL-CVS] [pecl-networking-ssh2] master: ssh2_fopen_wrappers: initialize php_stream_wrapper_ops explicitly (#68)

[email protected] (Gerdriaan Mulder via GitHub) Sat, 4 Apr 2026 10:53:29 +0000
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Gerdriaan Mulder (mrngm)
Committer: GitHub (web-flow)
Pusher: rlerdorf
Date: 2026-04-04T06:53:26-04:00

Commit: https://github.com/php/pecl-networking-ssh2/commit/8d9b6b4fcc7538c5d96eae8c0c384092e7aa9832
Raw diff: https://github.com/php/pecl-networking-ssh2/commit/8d9b6b4fcc7538c5d96eae8c0c384092e7aa9832.diff

ssh2_fopen_wrappers: initialize php_stream_wrapper_ops explicitly (#68)

* ssh2_fopen_wrappers: initialize php_stream_wrapper_ops explicitly

* ssh2_fopen_wrappers: initialize php_stream_wrapper_ops explicitly

* ssh2_sftp: fully initialize `php_ssh2_sftp_wrapper_ops`

And include comments to refer to PHP's `main/php_streams.h` struct `php_stream_wrapper_ops`.

Changed paths:
  M  ssh2_fopen_wrappers.c
  M  ssh2_sftp.c


Diff:

diff --git a/ssh2_fopen_wrappers.c b/ssh2_fopen_wrappers.c
index dd109a0..a1e8b6c 100644
--- a/ssh2_fopen_wrappers.c
+++ b/ssh2_fopen_wrappers.c
@@ -707,7 +707,12 @@ static php_stream_wrapper_ops php_ssh2_shell_stream_wops = {
 	NULL, /* stat */
 	NULL, /* stat_url */
 	NULL, /* opendir */
-	"ssh2.shell"
+	"ssh2.shell", /* label */
+	NULL, /* unlink */
+	NULL, /* rename */
+	NULL, /* mkdir */
+	NULL, /* rmdir */
+	NULL  /* stream_metadata */
 };
 
 php_stream_wrapper php_ssh2_stream_wrapper_shell = {
@@ -951,7 +956,12 @@ static php_stream_wrapper_ops php_ssh2_exec_stream_wops = {
 	NULL, /* stat */
 	NULL, /* stat_url */
 	NULL, /* opendir */
-	"ssh2.exec"
+	"ssh2.exec",  /* label */
+        NULL, /* unlink */
+        NULL, /* rename */
+        NULL, /* mkdir */
+        NULL, /* rmdir */
+        NULL  /* stream_metadata */
 };
 
 php_stream_wrapper php_ssh2_stream_wrapper_exec = {
@@ -1092,7 +1102,12 @@ static php_stream_wrapper_ops php_ssh2_scp_stream_wops = {
 	NULL, /* stat */
 	NULL, /* stat_url */
 	NULL, /* opendir */
-	"ssh2.scp"
+	"ssh2.scp",  /* label */
+        NULL, /* unlink */
+        NULL, /* rename */
+        NULL, /* mkdir */
+        NULL, /* rmdir */
+        NULL  /* stream_metadata */
 };
 
 php_stream_wrapper php_ssh2_stream_wrapper_scp = {
@@ -1374,7 +1389,12 @@ static php_stream_wrapper_ops php_ssh2_tunnel_stream_wops = {
 	NULL, /* stat */
 	NULL, /* stat_url */
 	NULL, /* opendir */
-	"ssh2.tunnel"
+	"ssh2.tunnel",  /* label */
+        NULL, /* unlink */
+        NULL, /* rename */
+        NULL, /* mkdir */
+        NULL, /* rmdir */
+        NULL  /* stream_metadata */
 };
 
 php_stream_wrapper php_ssh2_stream_wrapper_tunnel = {
diff --git a/ssh2_sftp.c b/ssh2_sftp.c
index f6caa48..da4e6bf 100644
--- a/ssh2_sftp.c
+++ b/ssh2_sftp.c
@@ -560,15 +560,16 @@ static int php_ssh2_sftp_rmdir(php_stream_wrapper *wrapper, const char *url, int
 
 static php_stream_wrapper_ops php_ssh2_sftp_wrapper_ops = {
 	php_ssh2_sftp_stream_opener,
-	NULL, /* close */
+	NULL, /* stream_close */
 	NULL, /* stat */
-	php_ssh2_sftp_urlstat,
-	php_ssh2_sftp_dirstream_opener,
-	PHP_SSH2_SFTP_WRAPPER_NAME,
-	php_ssh2_sftp_unlink,
-	php_ssh2_sftp_rename,
-	php_ssh2_sftp_mkdir,
-	php_ssh2_sftp_rmdir,
+	php_ssh2_sftp_urlstat, /* stat_url */
+	php_ssh2_sftp_dirstream_opener, /* opendir */
+	PHP_SSH2_SFTP_WRAPPER_NAME, /* label */
+	php_ssh2_sftp_unlink, /* unlink */
+	php_ssh2_sftp_rename, /* rename */
+	php_ssh2_sftp_mkdir, /* mkdir */
+	php_ssh2_sftp_rmdir, /* rmdir */
+	NULL /* stream_metadata */
 };
 
 php_stream_wrapper php_ssh2_sftp_wrapper = {