public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-php/pecl-ssh2/, dev-php/pecl-ssh2/files/
@ 2017-07-05  2:28 Brian Evans
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Evans @ 2017-07-05  2:28 UTC (permalink / raw
  To: gentoo-commits

commit:     e8e572057cf5e76ae91507d103caf29096eedf52
Author:     Brian Evans <grknight <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  5 02:27:36 2017 +0000
Commit:     Brian Evans <grknight <AT> gentoo <DOT> org>
CommitDate: Wed Jul  5 02:27:36 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e8e57205

dev-php/pecl-ssh2: Revbump to include upstream patch for 5.6; wrt bug 603290

Package-Manager: Portage-2.3.6, Repoman-2.3.2

 dev-php/pecl-ssh2/files/0.13-parse_url-fix.patch | 49 ++++++++++++++++++++++++
 dev-php/pecl-ssh2/pecl-ssh2-0.13-r3.ebuild       | 31 +++++++++++++++
 2 files changed, 80 insertions(+)

diff --git a/dev-php/pecl-ssh2/files/0.13-parse_url-fix.patch b/dev-php/pecl-ssh2/files/0.13-parse_url-fix.patch
new file mode 100644
index 00000000000..c9c052fd32d
--- /dev/null
+++ b/dev-php/pecl-ssh2/files/0.13-parse_url-fix.patch
@@ -0,0 +1,49 @@
+From 093906ec1c065e86ad1cd4dabbc89b1ccae11938 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@php.net>
+Date: Thu, 10 Nov 2016 09:16:02 +0100
+Subject: [PATCH] fix for PHP 7.0.13 where php_url_parse fails
+
+---
+ ssh2_fopen_wrappers.c | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/ssh2_fopen_wrappers.c b/ssh2_fopen_wrappers.c
+index 8472ddd..89b34eb 100644
+--- a/ssh2_fopen_wrappers.c
++++ b/ssh2_fopen_wrappers.c
+@@ -198,10 +198,20 @@ php_url *php_ssh2_fopen_wraper_parse_path(	char *path, char *type, php_stream_co
+ 	php_url *resource;
+ 	zval *methods = NULL, *callbacks = NULL, zsession, **tmpzval;
+ 	long resource_id;
+-	char *s, *username = NULL, *password = NULL, *pubkey_file = NULL, *privkey_file = NULL;
++	char *h, *s, *username = NULL, *password = NULL, *pubkey_file = NULL, *privkey_file = NULL;
+ 	int username_len = 0, password_len = 0;
+ 
+-	resource = php_url_parse(path);
++	h = strstr(path, "Resource id #");
++	if (h) {
++		/* Starting with 5.6.28, 7.0.13 need to be clean, else php_url_parse will fail */
++		char *tmp = estrdup(path);
++
++		strncpy(tmp + (h-path), h + sizeof("Resource id #")-1, strlen(tmp)-sizeof("Resource id #"));
++		resource = php_url_parse(tmp);
++		efree(tmp);
++	} else {
++		resource = php_url_parse(path);
++	}
+ 	if (!resource || !resource->path) {
+ 		return NULL;
+ 	}
+@@ -232,9 +242,6 @@ php_url *php_ssh2_fopen_wraper_parse_path(	char *path, char *type, php_stream_co
+ 
+ 	/* Look for a resource ID to reuse a session */
+ 	s = resource->host;
+-	if (strncmp(resource->host, "Resource id #", sizeof("Resource id #") - 1) == 0) {
+-		s = resource->host + sizeof("Resource id #") - 1;
+-	}
+ 	if (is_numeric_string(s, strlen(s), &resource_id, NULL, 0) == IS_LONG) {
+ 		php_ssh2_sftp_data *sftp_data;
+ 
+-- 
+2.1.4
+

diff --git a/dev-php/pecl-ssh2/pecl-ssh2-0.13-r3.ebuild b/dev-php/pecl-ssh2/pecl-ssh2-0.13-r3.ebuild
new file mode 100644
index 00000000000..ad10daaf227
--- /dev/null
+++ b/dev-php/pecl-ssh2/pecl-ssh2-0.13-r3.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PHP_EXT_NAME="ssh2"
+
+USE_PHP="php5-6 php7-0 php7-1"
+
+inherit php-ext-pecl-r3
+
+USE_PHP="php5-6"
+
+DESCRIPTION="PHP bindings for the libssh2 library"
+LICENSE="PHP-3.01"
+SLOT="0"
+IUSE=""
+KEYWORDS="~amd64 ~x86"
+DEPEND="net-libs/libssh2"
+RDEPEND="${DEPEND}"
+PDEPEND="php_targets_php7-0? ( dev-php/pecl-ssh2:7 )
+	php_targets_php7-1? ( dev-php/pecl-ssh2:7 )"
+
+src_prepare(){
+	if use php_targets_php5-6 ; then
+		local PATCHES=( "${FILESDIR}/0.13-parse_url-fix.patch" )
+		php-ext-source-r3_src_prepare
+	else
+		default_src_prepare
+	fi
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-php/pecl-ssh2/, dev-php/pecl-ssh2/files/
@ 2019-06-07 14:14 Thomas Deutschmann
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Deutschmann @ 2019-06-07 14:14 UTC (permalink / raw
  To: gentoo-commits

commit:     99a7b03f4133a1c6f8d5b68fa244762a3c41737a
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  7 14:07:30 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Jun  7 14:13:36 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=99a7b03f

dev-php/pecl-ssh2: add PHP 7.3 support

Package-Manager: Portage-2.3.67, Repoman-2.3.14
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 .../files/pecl-ssh2-1.1.2-fix-php7-port.patch      | 746 +++++++++++++++++++++
 ...1.1.2-fix-php_url-fields-usage-for-php7-3.patch | 302 +++++++++
 dev-php/pecl-ssh2/pecl-ssh2-1.1.2.ebuild           |  15 +-
 dev-php/pecl-ssh2/pecl-ssh2-9999.ebuild            |  10 +-
 4 files changed, 1063 insertions(+), 10 deletions(-)

diff --git a/dev-php/pecl-ssh2/files/pecl-ssh2-1.1.2-fix-php7-port.patch b/dev-php/pecl-ssh2/files/pecl-ssh2-1.1.2-fix-php7-port.patch
new file mode 100644
index 00000000000..9d4f9bd166e
--- /dev/null
+++ b/dev-php/pecl-ssh2/files/pecl-ssh2-1.1.2-fix-php7-port.patch
@@ -0,0 +1,746 @@
+From 073067ba96ac99ed5696d27f13ca6c8124986e74 Mon Sep 17 00:00:00 2001
+From: Jan-E <github@ehrhardt.nl>
+Date: Thu, 28 Jun 2018 08:43:48 +0200
+Subject: [PATCH] @dstogov Fixed PHP7 port. Restored commented reference
+ counting.
+
+---
+ php_ssh2.h            |  14 +++---
+ ssh2.c                |  26 +++++-----
+ ssh2_fopen_wrappers.c | 129 ++++++++++++++++++++++----------------------------
+ ssh2_sftp.c           |  59 ++++++++++-------------
+ 4 files changed, 102 insertions(+), 126 deletions(-)
+
+diff --git a/php_ssh2.h b/php_ssh2.h
+index d010ff9..2bbaa26 100644
+--- a/php_ssh2.h
++++ b/php_ssh2.h
+@@ -73,14 +73,14 @@ typedef struct _php_ssh2_sftp_data {
+ 	LIBSSH2_SESSION *session;
+ 	LIBSSH2_SFTP *sftp;
+ 
+-	int session_rsrcid;
++	zend_resource *session_rsrc;
+ } php_ssh2_sftp_data;
+ 
+ typedef struct _php_ssh2_listener_data {
+ 	LIBSSH2_SESSION *session;
+ 	LIBSSH2_LISTENER *listener;
+ 
+-	int session_rsrcid;
++	zend_resource *session_rsrc;
+ } php_ssh2_listener_data;
+ 
+ #include "libssh2_publickey.h"
+@@ -89,7 +89,7 @@ typedef struct _php_ssh2_pkey_subsys_data {
+ 	LIBSSH2_SESSION *session;
+ 	LIBSSH2_PUBLICKEY *pkey;
+ 
+-	int session_rsrcid;
++	zend_resource *session_rsrc;
+ } php_ssh2_pkey_subsys_data;
+ 
+ #define SSH2_FETCH_NONAUTHENTICATED_SESSION(session, zsession) \
+@@ -118,8 +118,8 @@ typedef struct _php_ssh2_channel_data {
+ 	char is_blocking;
+ 	long timeout;
+ 
+-	/* Resource ID */
+-	int session_rsrcid;
++	/* Resource */
++	zend_resource *session_rsrc;
+ 
+ 	/* Allow one stream to be closed while the other is kept open */
+ 	unsigned char *refcount;
+@@ -151,8 +151,8 @@ PHP_FUNCTION(ssh2_sftp_realpath);
+ LIBSSH2_SESSION *php_ssh2_session_connect(char *host, int port, zval *methods, zval *callbacks);
+ void php_ssh2_sftp_dtor(zend_resource *rsrc);
+ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stream_context *context,
+-											LIBSSH2_SESSION **psession, int *presource_id,
+-											LIBSSH2_SFTP **psftp, int *psftp_rsrcid);
++											LIBSSH2_SESSION **psession, zend_resource **presource,
++											LIBSSH2_SFTP **psftp, zend_resource **psftp_rsrc);
+ 
+ extern php_stream_ops php_ssh2_channel_stream_ops;
+ 
+diff --git a/ssh2.c b/ssh2.c
+index e73867e..849766b 100644
+--- a/ssh2.c
++++ b/ssh2.c
+@@ -772,9 +772,8 @@ PHP_FUNCTION(ssh2_forward_listen)
+ 
+ 	data = emalloc(sizeof(php_ssh2_listener_data));
+ 	data->session = session;
+-	data->session_rsrcid = Z_LVAL_P(zsession);
+-	//TODO Sean-Der
+-	//zend_list_addref(data->session_rsrcid);
++	data->session_rsrc = Z_RES_P(zsession);
++	Z_ADDREF_P(zsession);
+ 	data->listener = listener;
+ 
+ 	RETURN_RES(zend_register_resource(data, le_ssh2_listener));
+@@ -810,7 +809,7 @@ PHP_FUNCTION(ssh2_forward_accept)
+ 	channel_data->channel = channel;
+ 	channel_data->streamid = 0;
+ 	channel_data->is_blocking = 0;
+-	channel_data->session_rsrcid = data->session_rsrcid;
++	channel_data->session_rsrc = data->session_rsrc;
+ 	channel_data->refcount = NULL;
+ 
+ 	stream = php_stream_alloc(&php_ssh2_channel_stream_ops, channel_data, 0, "r+");
+@@ -820,8 +819,12 @@ PHP_FUNCTION(ssh2_forward_accept)
+ 		libssh2_channel_free(channel);
+ 		RETURN_FALSE;
+ 	}
+-	//TODO Sean-Der
+-	//zend_list_addref(channel_data->session_rsrcid);
++
++#if PHP_VERSION_ID < 70300
++	GC_REFCOUNT(channel_data->session_rsrc)++;
++#else
++	GC_ADDREF(channel_data->session_rsrc);
++#endif
+ 
+ 	php_stream_to_zval(stream, return_value);
+ }
+@@ -975,9 +978,8 @@ PHP_FUNCTION(ssh2_publickey_init)
+ 
+ 	data = emalloc(sizeof(php_ssh2_pkey_subsys_data));
+ 	data->session = session;
+-	data->session_rsrcid = Z_RES_P(zsession)->handle;
+-	//TODO Sean-Der
+-	//zend_list_addref(data->session_rsrcid);
++	data->session_rsrc = Z_RES_P(zsession);
++	Z_ADDREF_P(zsession);
+ 	data->pkey = pkey;
+ 
+ 	RETURN_RES(zend_register_resource(data, le_ssh2_pkey_subsys));
+@@ -1280,8 +1282,7 @@ static void php_ssh2_listener_dtor(zend_resource *rsrc)
+ 	LIBSSH2_LISTENER *listener = data->listener;
+ 
+ 	libssh2_channel_forward_cancel(listener);
+-	// TODO Sean-Der
+-	//zend_list_delete(data->session_rsrcid);
++	zend_list_delete(data->session_rsrc);
+ 	efree(data);
+ }
+ 
+@@ -1291,8 +1292,7 @@ static void php_ssh2_pkey_subsys_dtor(zend_resource *rsrc)
+ 	LIBSSH2_PUBLICKEY *pkey = data->pkey;
+ 
+ 	libssh2_publickey_shutdown(pkey);
+-	// TODO Sean-Der
+-	//zend_list_delete(data->session_rsrcid);
++	zend_list_delete(data->session_rsrc);
+ 	efree(data);
+ }
+ 
+diff --git a/ssh2_fopen_wrappers.c b/ssh2_fopen_wrappers.c
+index f2f3475..c4eb9dc 100644
+--- a/ssh2_fopen_wrappers.c
++++ b/ssh2_fopen_wrappers.c
+@@ -47,11 +47,9 @@ static size_t php_ssh2_channel_stream_write(php_stream *stream, const char *buf,
+ 	php_ssh2_channel_data *abstract = (php_ssh2_channel_data*)stream->abstract;
+ 	size_t writestate;
+ 	LIBSSH2_SESSION *session;
+-	zval *zresource;
+ 
+ 	libssh2_channel_set_blocking(abstract->channel, abstract->is_blocking);
+-	zresource = php_ssh2_zval_from_resource_handle(abstract->session_rsrcid);
+-	session = (LIBSSH2_SESSION *)zend_fetch_resource(Z_RES_P(zresource), PHP_SSH2_SESSION_RES_NAME, le_ssh2_session);
++	session = (LIBSSH2_SESSION *)zend_fetch_resource(abstract->session_rsrc, PHP_SSH2_SESSION_RES_NAME, le_ssh2_session);
+ 
+ 
+ 
+@@ -90,12 +88,10 @@ static size_t php_ssh2_channel_stream_read(php_stream *stream, char *buf, size_t
+ 	php_ssh2_channel_data *abstract = (php_ssh2_channel_data*)stream->abstract;
+ 	ssize_t readstate;
+ 	LIBSSH2_SESSION *session;
+-	zval *zresource;
+ 
+ 	stream->eof = libssh2_channel_eof(abstract->channel);
+ 	libssh2_channel_set_blocking(abstract->channel, abstract->is_blocking);
+-	zresource = php_ssh2_zval_from_resource_handle(abstract->session_rsrcid);
+-	session = (LIBSSH2_SESSION *)zend_fetch_resource(Z_RES_P(zresource), PHP_SSH2_SESSION_RES_NAME, le_ssh2_session);
++	session = (LIBSSH2_SESSION *)zend_fetch_resource(abstract->session_rsrc, PHP_SSH2_SESSION_RES_NAME, le_ssh2_session);
+ 
+ #ifdef PHP_SSH2_SESSION_TIMEOUT
+ 	if (abstract->is_blocking) {
+@@ -137,8 +133,7 @@ static int php_ssh2_channel_stream_close(php_stream *stream, int close_handle)
+ 		}
+ 		libssh2_channel_eof(abstract->channel);
+ 		libssh2_channel_free(abstract->channel);
+-		//TODO Sean-Der
+-		//zend_list_delete(abstract->session_rsrcid);
++		zend_list_delete(abstract->session_rsrc);
+ 	}
+ 	efree(abstract);
+ 
+@@ -207,8 +202,8 @@ php_stream_ops php_ssh2_channel_stream_ops = {
+  * Parse an ssh2.*:// path
+  */
+ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stream_context *context,
+-											LIBSSH2_SESSION **psession, int *presource_id,
+-											LIBSSH2_SFTP **psftp, int *psftp_rsrcid)
++											LIBSSH2_SESSION **psession, zend_resource **presource,
++											LIBSSH2_SFTP **psftp, zend_resource **psftp_rsrc)
+ {
+ 	php_ssh2_sftp_data *sftp_data = NULL;
+ 	LIBSSH2_SESSION *session;
+@@ -283,11 +278,10 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 			sftp_data = (php_ssh2_sftp_data *)zend_fetch_resource(Z_RES_P(zresource), PHP_SSH2_SFTP_RES_NAME, le_ssh2_sftp);
+ 			if (sftp_data) {
+ 				/* Want the sftp layer */
+-				//TODO Sean-Der
+-				//zend_list_addref(resource_id);
+-				*psftp_rsrcid = resource_id;
++				Z_ADDREF_P(zresource);
++				*psftp_rsrc = Z_RES_P(zresource);
+ 				*psftp = sftp_data->sftp;
+-				*presource_id = sftp_data->session_rsrcid;
++				*presource = sftp_data->session_rsrc;
+ 				*psession = sftp_data->session;
+ 				return resource;
+ 			}
+@@ -305,18 +299,16 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 				sftp_data = emalloc(sizeof(php_ssh2_sftp_data));
+ 				sftp_data->sftp = sftp;
+ 				sftp_data->session = session;
+-				sftp_data->session_rsrcid = resource_id;
+-				//TODO Sean-Der
+-				//zend_list_addref(resource_id);
+-				*psftp_rsrcid = zend_register_resource(sftp_data, le_ssh2_sftp)->handle;
++				sftp_data->session_rsrc = Z_RES_P(zresource);
++				Z_ADDREF_P(zresource);
++				*psftp_rsrc = zend_register_resource(sftp_data, le_ssh2_sftp);
+ 				*psftp = sftp;
+-				*presource_id = resource_id;
++				*presource = Z_RES_P(zresource);
+ 				*psession = session;
+ 				return resource;
+ 			}
+-			//TODO Sean-Der
+-			//zend_list_addref(resource_id);
+-			*presource_id = resource_id;
++			Z_ADDREF_P(zresource);
++			*presource = Z_RES_P(zresource);
+ 			*psession = session;
+ 			return resource;
+ 		}
+@@ -330,9 +322,9 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 		sftp_data = (php_ssh2_sftp_data *)zend_fetch_resource(Z_RES_P(tmpzval), PHP_SSH2_SFTP_RES_NAME, le_ssh2_sftp);
+ 		if (sftp_data) {
+ 			Z_ADDREF_P(tmpzval);
+-			*psftp_rsrcid = Z_LVAL_P(tmpzval);
++			*psftp_rsrc = Z_RES_P(tmpzval);
+ 			*psftp = sftp_data->sftp;
+-			*presource_id = sftp_data->session_rsrcid;
++			*presource = sftp_data->session_rsrc;
+ 			*psession = sftp_data->session;
+ 			return resource;
+ 		}
+@@ -354,17 +346,17 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 				sftp_data = emalloc(sizeof(php_ssh2_sftp_data));
+ 				sftp_data->sftp = sftp;
+ 				sftp_data->session = session;
+-				sftp_data->session_rsrcid = Z_LVAL_P(tmpzval);
++				sftp_data->session_rsrc = Z_RES_P(tmpzval);
+ 				Z_ADDREF_P(tmpzval);
+-				*psftp_rsrcid = zend_register_resource(sftp_data, le_ssh2_sftp)->handle;
++				*psftp_rsrc = zend_register_resource(sftp_data, le_ssh2_sftp);
+ 				*psftp = sftp;
+-				*presource_id = Z_RES_P(tmpzval)->handle;
++				*presource = Z_RES_P(tmpzval);
+ 				*psession = session;
+ 				return resource;
+ 			}
+ 			Z_ADDREF_P(tmpzval);
+ 			*psession = session;
+-			*presource_id = Z_LVAL_P(tmpzval);
++			*presource = Z_RES_P(tmpzval);
+ 			return resource;
+ 		}
+ 	}
+@@ -465,8 +457,7 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 
+ 	/* Auth failure */
+ 	php_url_free(resource);
+-	//TODO Sean-Der
+-	//zend_list_delete(Z_LVAL(zsession));
++	zend_list_delete(Z_RES(zsession));
+ 	return NULL;
+ 
+ session_authed:
+@@ -480,24 +471,22 @@ session_authed:
+ 		sftp = libssh2_sftp_init(session);
+ 		if (!sftp) {
+ 			php_url_free(resource);
+-			//TODO Sean-Der
+-			//zend_list_delete(Z_LVAL(zsession));
++			zend_list_delete(Z_RES(zsession));
+ 			return NULL;
+ 		}
+ 
+ 		sftp_data = emalloc(sizeof(php_ssh2_sftp_data));
+ 		sftp_data->session = session;
+ 		sftp_data->sftp = sftp;
+-		sftp_data->session_rsrcid = Z_LVAL(zsession);
++		sftp_data->session_rsrc = Z_RES(zsession);
+ 
+ 		//TODO Sean-Der
+ 		//ZEND_REGISTER_RESOURCE(sftp_data, le_ssh2_sftp);
+-		*psftp_rsrcid = Z_LVAL(zsftp);
++		*psftp_rsrc = Z_RES(zsftp);
+ 		*psftp = sftp;
+ 	}
+ 
+-	//TODO may be undefined
+-	*presource_id = Z_LVAL(zsession);
++	*presource = Z_RES(zsession);
+ 	*psession = session;
+ 
+ 	return resource;
+@@ -511,7 +500,7 @@ session_authed:
+ /* {{{ php_ssh2_shell_open
+  * Make a stream from a session
+  */
+-static php_stream *php_ssh2_shell_open(LIBSSH2_SESSION *session, int resource_id, char *term, int term_len, zval *environment, long width, long height, long type)
++static php_stream *php_ssh2_shell_open(LIBSSH2_SESSION *session, zend_resource *resource, char *term, int term_len, zval *environment, long width, long height, long type)
+ {
+ 	LIBSSH2_CHANNEL *channel;
+ 	php_ssh2_channel_data *channel_data;
+@@ -578,7 +567,7 @@ static php_stream *php_ssh2_shell_open(LIBSSH2_SESSION *session, int resource_id
+ 	channel_data->streamid = 0;
+ 	channel_data->is_blocking = 0;
+ 	channel_data->timeout = 0;
+-	channel_data->session_rsrcid = resource_id;
++	channel_data->session_rsrc = resource;
+ 	channel_data->refcount = NULL;
+ 
+ 	stream = php_stream_alloc(&php_ssh2_channel_stream_ops, channel_data, 0, "r+");
+@@ -599,11 +588,12 @@ static php_stream *php_ssh2_fopen_wrapper_shell(php_stream_wrapper *wrapper, con
+ 	zend_long width = PHP_SSH2_DEFAULT_TERM_WIDTH;
+ 	zend_long height = PHP_SSH2_DEFAULT_TERM_HEIGHT;
+ 	zend_long type = PHP_SSH2_DEFAULT_TERM_UNIT;
+-	int resource_id = 0, terminal_len = sizeof(PHP_SSH2_DEFAULT_TERMINAL) - 1;
++	zend_resource *rsrc = NULL;
++	int terminal_len = sizeof(PHP_SSH2_DEFAULT_TERMINAL) - 1;
+ 	php_url *resource;
+ 	char *s;
+ 
+-	resource = php_ssh2_fopen_wraper_parse_path(path, "shell", context, &session, &resource_id, NULL, NULL);
++	resource = php_ssh2_fopen_wraper_parse_path(path, "shell", context, &session, &rsrc, NULL, NULL);
+ 	if (!resource || !session) {
+ 		return NULL;
+ 	}
+@@ -677,10 +667,9 @@ static php_stream *php_ssh2_fopen_wrapper_shell(php_stream_wrapper *wrapper, con
+ 	/* TODO: Accept resolution and environment vars as URL style parameters
+ 	 * ssh2.shell://hostorresource/terminal/99x99c?envvar=envval&envvar=envval....
+ 	 */
+-	stream = php_ssh2_shell_open(session, resource_id, terminal, terminal_len, environment, width, height, type);
++	stream = php_ssh2_shell_open(session, rsrc, terminal, terminal_len, environment, width, height, type);
+ 	if (!stream) {
+-		//TODO Sean-Der
+-		//zend_list_delete(resource_id);
++		zend_list_delete(rsrc);
+ 	}
+ 	php_url_free(resource);
+ 
+@@ -730,7 +719,7 @@ PHP_FUNCTION(ssh2_shell)
+ 
+ 	SSH2_FETCH_AUTHENTICATED_SESSION(session, zsession);
+ 
+-	stream = php_ssh2_shell_open(session, Z_RES_P(zsession)->handle, term, term_len, environment, width, height, type);
++	stream = php_ssh2_shell_open(session, Z_RES_P(zsession), term, term_len, environment, width, height, type);
+ 	if (!stream) {
+ 		RETURN_FALSE;
+ 	}
+@@ -749,7 +738,7 @@ PHP_FUNCTION(ssh2_shell)
+ /* {{{ php_ssh2_exec_command
+  * Make a stream from a session
+  */
+-static php_stream *php_ssh2_exec_command(LIBSSH2_SESSION *session, int resource_id, char *command, char *term, int term_len, zval *environment, long width, long height, long type)
++static php_stream *php_ssh2_exec_command(LIBSSH2_SESSION *session, zend_resource *rsrc, char *command, char *term, int term_len, zval *environment, long width, long height, long type)
+ {
+ 	LIBSSH2_CHANNEL *channel;
+ 	php_ssh2_channel_data *channel_data;
+@@ -819,7 +808,7 @@ static php_stream *php_ssh2_exec_command(LIBSSH2_SESSION *session, int resource_
+ 	channel_data->streamid = 0;
+ 	channel_data->is_blocking = 0;
+ 	channel_data->timeout = 0;
+-	channel_data->session_rsrcid = resource_id;
++	channel_data->session_rsrc = rsrc;
+ 	channel_data->refcount = NULL;
+ 
+ 	stream = php_stream_alloc(&php_ssh2_channel_stream_ops, channel_data, 0, "r+");
+@@ -836,7 +825,7 @@ static php_stream *php_ssh2_fopen_wrapper_exec(php_stream_wrapper *wrapper, cons
+ 	LIBSSH2_SESSION *session = NULL;
+ 	php_stream *stream;
+ 	zval *tmpzval, *environment = NULL;
+-	int resource_id = 0;
++	zend_resource *rsrc = NULL;
+ 	php_url *resource;
+ 	char *terminal = NULL;
+ 	int terminal_len = 0;
+@@ -844,14 +833,13 @@ static php_stream *php_ssh2_fopen_wrapper_exec(php_stream_wrapper *wrapper, cons
+ 	long height = PHP_SSH2_DEFAULT_TERM_HEIGHT;
+ 	long type = PHP_SSH2_DEFAULT_TERM_UNIT;
+ 
+-	resource = php_ssh2_fopen_wraper_parse_path(path, "exec", context, &session, &resource_id, NULL, NULL);
++	resource = php_ssh2_fopen_wraper_parse_path(path, "exec", context, &session, &rsrc, NULL, NULL);
+ 	if (!resource || !session) {
+ 		return NULL;
+ 	}
+ 	if (!resource->path) {
+ 		php_url_free(resource);
+-		//TODO Sean-Der
+-		//zend_list_delete(resource_id);
++		zend_list_delete(rsrc);
+ 		return NULL;
+ 	}
+ 
+@@ -893,10 +881,9 @@ static php_stream *php_ssh2_fopen_wrapper_exec(php_stream_wrapper *wrapper, cons
+ 		zval_ptr_dtor(copyval);
+ 	}
+ 
+-	stream = php_ssh2_exec_command(session, resource_id, SSH2_URL_STR(resource->path) + 1, terminal, terminal_len, environment, width, height, type);
++	stream = php_ssh2_exec_command(session, rsrc, SSH2_URL_STR(resource->path) + 1, terminal, terminal_len, environment, width, height, type);
+ 	if (!stream) {
+-		// TODO Sean-Der
+-		//zend_list_delete(resource_id);
++		zend_list_delete(rsrc);
+ 	}
+ 	php_url_free(resource);
+ 
+@@ -963,7 +950,7 @@ PHP_FUNCTION(ssh2_exec)
+ 
+ 	SSH2_FETCH_AUTHENTICATED_SESSION(session, zsession);
+ 
+-	stream = php_ssh2_exec_command(session, Z_RES_P(zsession)->handle, command, term, term_len, environment, width, height, type);
++	stream = php_ssh2_exec_command(session, Z_RES_P(zsession), command, term, term_len, environment, width, height, type);
+ 	if (!stream) {
+ 		RETURN_FALSE;
+ 	}
+@@ -982,7 +969,7 @@ PHP_FUNCTION(ssh2_exec)
+ /* {{{ php_ssh2_scp_xfer
+  * Make a stream from a session
+  */
+-static php_stream *php_ssh2_scp_xfer(LIBSSH2_SESSION *session, int resource_id, char *filename)
++static php_stream *php_ssh2_scp_xfer(LIBSSH2_SESSION *session, zend_resource *rsrc, char *filename)
+ {
+ 	LIBSSH2_CHANNEL *channel;
+ 	php_ssh2_channel_data *channel_data;
+@@ -1002,7 +989,7 @@ static php_stream *php_ssh2_scp_xfer(LIBSSH2_SESSION *session, int resource_id,
+ 	channel_data->streamid = 0;
+ 	channel_data->is_blocking = 0;
+ 	channel_data->timeout = 0;
+-	channel_data->session_rsrcid = resource_id;
++	channel_data->session_rsrc = rsrc;
+ 	channel_data->refcount = NULL;
+ 
+ 	stream = php_stream_alloc(&php_ssh2_channel_stream_ops, channel_data, 0, "r");
+@@ -1018,28 +1005,26 @@ static php_stream *php_ssh2_fopen_wrapper_scp(php_stream_wrapper *wrapper, const
+ {
+ 	LIBSSH2_SESSION *session = NULL;
+ 	php_stream *stream;
+-	int resource_id = 0;
++	zend_resource *rsrc = NULL;
+ 	php_url *resource;
+ 
+ 	if (strchr(mode, '+') || strchr(mode, 'a') || strchr(mode, 'w')) {
+ 		return NULL;
+ 	}
+ 
+-	resource = php_ssh2_fopen_wraper_parse_path(path, "scp", context, &session, &resource_id, NULL, NULL);
++	resource = php_ssh2_fopen_wraper_parse_path(path, "scp", context, &session, &rsrc, NULL, NULL);
+ 	if (!resource || !session) {
+ 		return NULL;
+ 	}
+ 	if (!resource->path) {
+ 		php_url_free(resource);
+-		//TODO Sean-Der
+-		//zend_list_delete(resource_id);
++		zend_list_delete(rsrc);
+ 		return NULL;
+ 	}
+ 
+-	stream = php_ssh2_scp_xfer(session, resource_id, SSH2_URL_STR(resource->path));
++	stream = php_ssh2_scp_xfer(session, rsrc, SSH2_URL_STR(resource->path));
+ 	if (!stream) {
+-		//TODO Sean-Der
+-		//zend_list_delete(resource_id);
++		zend_list_delete(rsrc);
+ 	}
+ 	php_url_free(resource);
+ 
+@@ -1231,7 +1216,7 @@ PHP_FUNCTION(ssh2_scp_send)
+ /* {{{ php_ssh2_direct_tcpip
+  * Make a stream from a session
+  */
+-static php_stream *php_ssh2_direct_tcpip(LIBSSH2_SESSION *session, int resource_id, char *host, int port)
++static php_stream *php_ssh2_direct_tcpip(LIBSSH2_SESSION *session, zend_resource *rsrc, char *host, int port)
+ {
+ 	LIBSSH2_CHANNEL *channel;
+ 	php_ssh2_channel_data *channel_data;
+@@ -1251,7 +1236,7 @@ static php_stream *php_ssh2_direct_tcpip(LIBSSH2_SESSION *session, int resource_
+ 	channel_data->streamid = 0;
+ 	channel_data->is_blocking = 0;
+ 	channel_data->timeout = 0;
+-	channel_data->session_rsrcid = resource_id;
++	channel_data->session_rsrc = rsrc;
+ 	channel_data->refcount = NULL;
+ 
+ 	stream = php_stream_alloc(&php_ssh2_channel_stream_ops, channel_data, 0, "r+");
+@@ -1270,9 +1255,9 @@ static php_stream *php_ssh2_fopen_wrapper_tunnel(php_stream_wrapper *wrapper, co
+ 	php_url *resource;
+ 	char *host = NULL;
+ 	int port = 0;
+-	int resource_id = 0;
++	zend_resource *rsrc;
+ 
+-	resource = php_ssh2_fopen_wraper_parse_path(path, "tunnel", context, &session, &resource_id, NULL, NULL);
++	resource = php_ssh2_fopen_wraper_parse_path(path, "tunnel", context, &session, &rsrc, NULL, NULL);
+ 	if (!resource || !session) {
+ 		return NULL;
+ 	}
+@@ -1303,15 +1288,13 @@ static php_stream *php_ssh2_fopen_wrapper_tunnel(php_stream_wrapper *wrapper, co
+ 	if ((port <= 0) || (port > 65535) || !host || (strlen(host) == 0)) {
+ 		/* Invalid connection criteria */
+ 		php_url_free(resource);
+-		//TODO Sean-Der
+-		//zend_list_delete(resource_id);
++		zend_list_delete(rsrc);
+ 		return NULL;
+ 	}
+ 
+-	stream = php_ssh2_direct_tcpip(session, resource_id, host, port);
++	stream = php_ssh2_direct_tcpip(session, rsrc, host, port);
+ 	if (!stream) {
+-		// TODO Sean-Der
+-		//zend_list_delete(resource_id);
++		zend_list_delete(rsrc);
+ 	}
+ 	php_url_free(resource);
+ 
+@@ -1352,7 +1335,7 @@ PHP_FUNCTION(ssh2_tunnel)
+ 
+ 	SSH2_FETCH_AUTHENTICATED_SESSION(session, zsession);
+ 
+-	stream = php_ssh2_direct_tcpip(session, Z_RES_P(zsession)->handle, host, port);
++	stream = php_ssh2_direct_tcpip(session, Z_RES_P(zsession), host, port);
+ 	if (!stream) {
+ 		RETURN_FALSE;
+ 	}
+diff --git a/ssh2_sftp.c b/ssh2_sftp.c
+index 6332be8..256fc70 100644
+--- a/ssh2_sftp.c
++++ b/ssh2_sftp.c
+@@ -40,8 +40,7 @@ void php_ssh2_sftp_dtor(zend_resource *rsrc)
+ 
+ 	libssh2_sftp_shutdown(data->sftp);
+ 
+-	// TODO Sean-Der
+-	//zend_list_delete(data->session_rsrcid);
++	zend_list_delete(data->session_rsrc);
+ 
+ 	efree(data);
+ }
+@@ -50,7 +49,7 @@ void php_ssh2_sftp_dtor(zend_resource *rsrc)
+    * SFTP File Ops *
+    ***************** */
+ 
+-inline unsigned long php_ssh2_parse_fopen_modes(char *openmode) {
++unsigned long php_ssh2_parse_fopen_modes(char *openmode) {
+ 	unsigned long flags = 0;
+ 
+ 	if (strchr(openmode, 'a')) {
+@@ -101,7 +100,7 @@ inline int php_ssh2_sftp_attr2ssb(php_stream_statbuf *ssb, LIBSSH2_SFTP_ATTRIBUT
+ typedef struct _php_ssh2_sftp_handle_data {
+ 	LIBSSH2_SFTP_HANDLE *handle;
+ 
+-	long sftp_rsrcid;
++	zend_resource *sftp_rsrc;
+ } php_ssh2_sftp_handle_data;
+ 
+ /* {{{ php_ssh2_sftp_stream_write
+@@ -139,8 +138,7 @@ static int php_ssh2_sftp_stream_close(php_stream *stream, int close_handle)
+ 	php_ssh2_sftp_handle_data *data = (php_ssh2_sftp_handle_data*)stream->abstract;
+ 
+ 	libssh2_sftp_close(data->handle);
+-	//TODO Sean-Der
+-	//zend_list_delete(data->sftp_rsrcid);
++	zend_list_delete(data->sftp_rsrc);
+ 	efree(data);
+ 
+ 	return 0;
+@@ -226,12 +224,12 @@ static php_stream *php_ssh2_sftp_stream_opener(php_stream_wrapper *wrapper, cons
+ 	LIBSSH2_SFTP *sftp = NULL;
+ 	LIBSSH2_SFTP_HANDLE *handle;
+ 	php_stream *stream;
+-	int resource_id = 0, sftp_rsrcid = 0;
++	zend_resource *rsrc = NULL, *sftp_rsrc = NULL;
+ 	php_url *resource;
+ 	unsigned long flags;
+ 	long perms = 0644;
+ 
+-	resource = php_ssh2_fopen_wraper_parse_path(filename, "sftp", context, &session, &resource_id, &sftp, &sftp_rsrcid);
++	resource = php_ssh2_fopen_wraper_parse_path(filename, "sftp", context, &session, &rsrc, &sftp, &sftp_rsrc);
+ 	if (!resource || !session || !sftp) {
+ 		return NULL;
+ 	}
+@@ -242,20 +240,18 @@ static php_stream *php_ssh2_sftp_stream_opener(php_stream_wrapper *wrapper, cons
+ 	if (!handle) {
+ 		php_error_docref(NULL, E_WARNING, "Unable to open %s on remote host", filename);
+ 		php_url_free(resource);
+-		//TODO Sean-Der
+-		//zend_list_delete(sftp_rsrcid);
++		zend_list_delete(sftp_rsrc);
+ 		return NULL;
+ 	}
+ 
+ 	data = emalloc(sizeof(php_ssh2_sftp_handle_data));
+ 	data->handle = handle;
+-	data->sftp_rsrcid = sftp_rsrcid;
++	data->sftp_rsrc = sftp_rsrc;
+ 
+ 	stream = php_stream_alloc(&php_ssh2_sftp_stream_ops, data, 0, mode);
+ 	if (!stream) {
+ 		libssh2_sftp_close(handle);
+-		// TODO Sean-Der
+-		//zend_list_delete(sftp_rsrcid);
++		zend_list_delete(sftp_rsrc);
+ 		efree(data);
+ 	}
+ 	php_url_free(resource);
+@@ -303,8 +299,7 @@ static int php_ssh2_sftp_dirstream_close(php_stream *stream, int close_handle)
+ 	php_ssh2_sftp_handle_data *data = (php_ssh2_sftp_handle_data*)stream->abstract;
+ 
+ 	libssh2_sftp_close(data->handle);
+-	//TODO Sean_der
+-	//zend_list_delete(data->sftp_rsrcid);
++	zend_list_delete(data->sftp_rsrc);
+ 	efree(data);
+ 
+ 	return 0;
+@@ -333,10 +328,10 @@ static php_stream *php_ssh2_sftp_dirstream_opener(php_stream_wrapper *wrapper, c
+ 	LIBSSH2_SFTP *sftp = NULL;
+ 	LIBSSH2_SFTP_HANDLE *handle;
+ 	php_stream *stream;
+-	int resource_id = 0, sftp_rsrcid = 0;
++	zend_resource *rsrc = NULL, *sftp_rsrc = NULL;
+ 	php_url *resource;
+ 
+-	resource = php_ssh2_fopen_wraper_parse_path(filename, "sftp", context, &session, &resource_id, &sftp, &sftp_rsrcid);
++	resource = php_ssh2_fopen_wraper_parse_path(filename, "sftp", context, &session, &rsrc, &sftp, &sftp_rsrc);
+ 	if (!resource || !session || !sftp) {
+ 		return NULL;
+ 	}
+@@ -345,20 +340,18 @@ static php_stream *php_ssh2_sftp_dirstream_opener(php_stream_wrapper *wrapper, c
+ 	if (!handle) {
+ 		php_error_docref(NULL, E_WARNING, "Unable to open %s on remote host", filename);
+ 		php_url_free(resource);
+-		//TODO Sean-Der
+-		//zend_list_delete(sftp_rsrcid);
++		zend_list_delete(sftp_rsrc);
+ 		return NULL;
+ 	}
+ 
+ 	data = emalloc(sizeof(php_ssh2_sftp_handle_data));
+ 	data->handle = handle;
+-	data->sftp_rsrcid = sftp_rsrcid;
++	data->sftp_rsrc = sftp_rsrc;
+ 
+ 	stream = php_stream_alloc(&php_ssh2_sftp_dirstream_ops, data, 0, mode);
+ 	if (!stream) {
+ 		libssh2_sftp_close(handle);
+-		//TODO Sean-Der
+-		//zend_list_delete(sftp_rsrcid);
++		zend_list_delete(sftp_rsrc);
+ 		efree(data);
+ 	}
+ 	php_url_free(resource);
+@@ -378,10 +371,10 @@ static int php_ssh2_sftp_urlstat(php_stream_wrapper *wrapper, const char *url, i
+ 	LIBSSH2_SFTP_ATTRIBUTES attrs;
+ 	LIBSSH2_SESSION *session = NULL;
+ 	LIBSSH2_SFTP *sftp = NULL;
+-	int resource_id = 0, sftp_rsrcid = 0;
++	zend_resource *rsrc = NULL, *sftp_rsrc = NULL;
+ 	php_url *resource;
+ 
+-	resource = php_ssh2_fopen_wraper_parse_path(url, "sftp", context, &session, &resource_id, &sftp, &sftp_rsrcid);
++	resource = php_ssh2_fopen_wraper_parse_path(url, "sftp", context, &session, &rsrc, &sftp, &sftp_rsrc);
+ 	if (!resource || !session || !sftp || !resource->path) {
+ 		return -1;
+ 	}
+@@ -408,11 +401,11 @@ static int php_ssh2_sftp_unlink(php_stream_wrapper *wrapper, const char *url, in
+ {
+ 	LIBSSH2_SESSION *session = NULL;
+ 	LIBSSH2_SFTP *sftp = NULL;
+-	int resource_id = 0, sftp_rsrcid = 0;
++	zend_resource *rsrc = NULL, *sftp_rsrc = NULL;
+ 	php_url *resource;
+ 	int result;
+ 
+-	resource = php_ssh2_fopen_wraper_parse_path(url, "sftp", context, &session, &resource_id, &sftp, &sftp_rsrcid);
++	resource = php_ssh2_fopen_wraper_parse_path(url, "sftp", context, &session, &rsrc, &sftp, &sftp_rsrc);
+ 	if (!resource || !session || !sftp || !resource->path) {
+ 		if (resource) {
+ 			php_url_free(resource);
+@@ -436,7 +429,7 @@ static int php_ssh2_sftp_rename(php_stream_wrapper *wrapper, const char *url_fro
+ {
+ 	LIBSSH2_SESSION *session = NULL;
+ 	LIBSSH2_SFTP *sftp = NULL;
+-	int resource_id = 0, sftp_rsrcid = 0;
++	zend_resource *rsrc = NULL, *sftp_rsrc = NULL;
+ 	php_url *resource, *resource_to;
+ 	int result;
+ 
+@@ -453,7 +446,7 @@ static int php_ssh2_sftp_rename(php_stream_wrapper *wrapper, const char *url_fro
+ 		return 0;
+ 	}
+ 
+-	resource = php_ssh2_fopen_wraper_parse_path(url_from, "sftp", context, &session, &resource_id, &sftp, &sftp_rsrcid);
++	resource = php_ssh2_fopen_wraper_parse_path(url_from, "sftp", context, &session, &rsrc, &sftp, &sftp_rsrc);
+ 	if (!resource || !session || !sftp || !resource->path) {
+ 		if (resource) {
+ 			php_url_free(resource);
+@@ -479,11 +472,11 @@ static int php_ssh2_sftp_mkdir(php_stream_wrapper *wrapper, const char *url, int
+ {
+ 	LIBSSH2_SESSION *session = NULL;
+ 	LIBSSH2_SFTP *sftp = NULL;
+-	int resource_id = 0, sftp_rsrcid = 0;
++	zend_resource *rsrc = NULL, *sftp_rsrc = NULL;
+ 	php_url *resource;
+ 	int result;
+ 
+-	resource = php_ssh2_fopen_wraper_parse_path(url, "sftp", context, &session, &resource_id, &sftp, &sftp_rsrcid);
++	resource = php_ssh2_fopen_wraper_parse_path(url, "sftp", context, &session, &rsrc, &sftp, &sftp_rsrc);
+ 	if (!resource || !session || !sftp || !resource->path) {
+ 		if (resource) {
+ 			php_url_free(resource);
+@@ -515,11 +508,11 @@ static int php_ssh2_sftp_rmdir(php_stream_wrapper *wrapper, const char *url, int
+ {
+ 	LIBSSH2_SESSION *session = NULL;
+ 	LIBSSH2_SFTP *sftp = NULL;
+-	int resource_id = 0, sftp_rsrcid = 0;
++	zend_resource *rsrc = NULL, *sftp_rsrc = NULL;
+ 	php_url *resource;
+ 	int result;
+ 
+-	resource = php_ssh2_fopen_wraper_parse_path(url, "sftp", context, &session, &resource_id, &sftp, &sftp_rsrcid);
++	resource = php_ssh2_fopen_wraper_parse_path(url, "sftp", context, &session, &rsrc, &sftp, &sftp_rsrc);
+ 	if (!resource || !session || !sftp || !resource->path) {
+ 		if (resource) {
+ 			php_url_free(resource);
+@@ -591,7 +584,7 @@ PHP_FUNCTION(ssh2_sftp)
+ 	data = emalloc(sizeof(php_ssh2_sftp_data));
+ 	data->session = session;
+ 	data->sftp = sftp;
+-	data->session_rsrcid = Z_RES_P(zsession)->handle;
++	data->session_rsrc = Z_RES_P(zsession);
+ 	Z_ADDREF_P(zsession);
+ 
+ 	RETURN_RES(zend_register_resource(data, le_ssh2_sftp));
+-- 
+2.1.4
+

diff --git a/dev-php/pecl-ssh2/files/pecl-ssh2-1.1.2-fix-php_url-fields-usage-for-php7-3.patch b/dev-php/pecl-ssh2/files/pecl-ssh2-1.1.2-fix-php_url-fields-usage-for-php7-3.patch
new file mode 100644
index 00000000000..1f135256422
--- /dev/null
+++ b/dev-php/pecl-ssh2/files/pecl-ssh2-1.1.2-fix-php_url-fields-usage-for-php7-3.patch
@@ -0,0 +1,302 @@
+From a8835aab2c15e794fce13bd927295719e384ad2d Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@php.net>
+Date: Thu, 28 Jun 2018 07:10:35 +0200
+Subject: [PATCH] fix php_url fields usage for PHP 7.3
+
+---
+ php_ssh2.h            |  8 ++++++++
+ ssh2_fopen_wrappers.c | 55 ++++++++++++++++++++++++++++++++-------------------
+ ssh2_sftp.c           | 20 +++++++++----------
+ 3 files changed, 53 insertions(+), 30 deletions(-)
+
+diff --git a/php_ssh2.h b/php_ssh2.h
+index 734b795..d010ff9 100644
+--- a/php_ssh2.h
++++ b/php_ssh2.h
+@@ -166,6 +166,14 @@ extern php_stream_wrapper php_ssh2_sftp_wrapper;
+ extern int le_ssh2_session;
+ extern int le_ssh2_sftp;
+ 
++#if PHP_VERSION_ID < 70300
++#define SSH2_URL_STR(a) (a)
++#define SSH2_URL_LEN(a) strlen(a)
++#else
++#define SSH2_URL_STR(a) ZSTR_VAL(a)
++#define SSH2_URL_LEN(a) ZSTR_LEN(a)
++#endif
++
+ #endif	/* PHP_SSH2_H */
+ 
+ /*
+diff --git a/ssh2_fopen_wrappers.c b/ssh2_fopen_wrappers.c
+index 2f96ca4..f2f3475 100644
+--- a/ssh2_fopen_wrappers.c
++++ b/ssh2_fopen_wrappers.c
+@@ -215,7 +215,7 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 	php_url *resource;
+ 	zval *methods = NULL, *callbacks = NULL, zsession, *tmpzval;
+ 	zend_long resource_id;
+-	char *h, *s, *username = NULL, *password = NULL, *pubkey_file = NULL, *privkey_file = NULL;
++	char *h, *username = NULL, *password = NULL, *pubkey_file = NULL, *privkey_file = NULL;
+ 	int username_len = 0, password_len = 0;
+ 
+ 	h = strstr(path, "Resource id #");
+@@ -233,13 +233,13 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 		return NULL;
+ 	}
+ 
+-	if (strncmp(resource->scheme, "ssh2.", sizeof("ssh2.") - 1)) {
++	if (strncmp(SSH2_URL_STR(resource->scheme), "ssh2.", sizeof("ssh2.") - 1)) {
+ 		/* Not an ssh wrapper */
+ 		php_url_free(resource);
+ 		return NULL;
+ 	}
+ 
+-	if (strcmp(resource->scheme + sizeof("ssh2.") - 1, type)) {
++	if (strcmp(SSH2_URL_STR(resource->scheme) + sizeof("ssh2.") - 1, type)) {
+ 		/* Wrong ssh2. wrapper type */
+ 		php_url_free(resource);
+ 		return NULL;
+@@ -253,13 +253,27 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 		Find resource->path in the path string, then copy the entire string from the original path.
+ 		This includes ?query#fragment in the path string
+ 	*/
++// TODO copy seems uneeded
++#if PHP_VERSION_ID < 70300
++	{
++	char * s;
++
+ 	s = resource->path;
+ 	resource->path = estrdup(strstr(path, resource->path));
+ 	efree(s);
++	}
++#else
++	{
++	zend_string *tmp;
++
++	tmp = resource->path;
++	resource->path = zend_string_init(ZSTR_VAL(resource->path), ZSTR_LEN(resource->path), 0);
++	zend_string_release(tmp);
++	}
++#endif
+ 
+ 	/* Look for a resource ID to reuse a session */
+-	s = resource->host;
+-	if (is_numeric_string(s, strlen(s), &resource_id, NULL, 0) == IS_LONG) {
++	if (is_numeric_string(SSH2_URL_STR(resource->host), SSH2_URL_LEN(resource->host), &resource_id, NULL, 0) == IS_LONG) {
+ 		php_ssh2_sftp_data *sftp_data;
+ 		zval *zresource;
+ 
+@@ -309,7 +323,7 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 	}
+ 
+ 	/* Fallback on finding it in the context */
+-	if (resource->host[0] == 0 && context && psftp &&
++	if (SSH2_URL_STR(resource->host)[0] == 0 && context && psftp &&
+ 		(tmpzval = php_stream_context_get_option(context, "ssh2", "sftp")) != NULL &&
+ 		Z_TYPE_P(tmpzval) == IS_RESOURCE) {
+ 		php_ssh2_sftp_data *sftp_data;
+@@ -323,7 +337,7 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 			return resource;
+ 		}
+ 	}
+-	if (resource->host[0] == 0 && context &&
++	if (SSH2_URL_STR(resource->host)[0] == 0 && context &&
+ 		(tmpzval = php_stream_context_get_option(context, "ssh2", "session")) != NULL &&
+ 		Z_TYPE_P(tmpzval) == IS_RESOURCE) {
+ 		session = (LIBSSH2_SESSION *)zend_fetch_resource(Z_RES_P(tmpzval), PHP_SSH2_SESSION_RES_NAME, le_ssh2_session);
+@@ -399,19 +413,19 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 	}
+ 
+ 	if (resource->user) {
+-		int len = strlen(resource->user);
++		int len = SSH2_URL_LEN(resource->user);
+ 
+ 		if (len) {
+-			username = resource->user;
++			username = SSH2_URL_STR(resource->user);
+ 			username_len = len;
+ 		}
+ 	}
+ 
+ 	if (resource->pass) {
+-		int len = strlen(resource->pass);
++		int len = SSH2_URL_LEN(resource->pass);
+ 
+ 		if (len) {
+-			password = resource->pass;
++			password = SSH2_URL_STR(resource->pass);
+ 			password_len = len;
+ 		}
+ 	}
+@@ -422,7 +436,7 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
+ 		return NULL;
+ 	}
+ 
+-	session = php_ssh2_session_connect(resource->host, resource->port, methods, callbacks);
++	session = php_ssh2_session_connect(SSH2_URL_STR(resource->host), resource->port, methods, callbacks);
+ 	if (!session) {
+ 		/* Unable to connect! */
+ 		php_url_free(resource);
+@@ -482,6 +496,7 @@ session_authed:
+ 		*psftp = sftp;
+ 	}
+ 
++	//TODO may be undefined
+ 	*presource_id = Z_LVAL(zsession);
+ 	*psession = session;
+ 
+@@ -527,7 +542,7 @@ static php_stream *php_ssh2_shell_open(LIBSSH2_SESSION *session, int resource_id
+ 					zval_copy_ctor(&copyval);
+ 					convert_to_string(&copyval);
+ 					if (libssh2_channel_setenv_ex(channel, key->val, key->len, Z_STRVAL(copyval), Z_STRLEN(copyval))) {
+-						php_error_docref(NULL, E_WARNING, "Failed setting %s=%s on remote end", key, Z_STRVAL(copyval));
++						php_error_docref(NULL, E_WARNING, "Failed setting %s=%s on remote end", ZSTR_VAL(key), Z_STRVAL(copyval));
+ 					}
+ 					zval_dtor(&copyval);
+ 				}
+@@ -631,7 +646,7 @@ static php_stream *php_ssh2_fopen_wrapper_shell(php_stream_wrapper *wrapper, con
+ 		zval_ptr_dtor(&copyval);
+ 	}
+ 
+-	s = resource->path ? resource->path : NULL;
++	s = resource->path ? SSH2_URL_STR(resource->path) : NULL;
+ 
+ 	if (s && s[0] == '/') {
+ 		/* Terminal type encoded into URL overrides context terminal type */
+@@ -766,7 +781,7 @@ static php_stream *php_ssh2_exec_command(LIBSSH2_SESSION *session, int resource_
+ 					zval_copy_ctor(&copyval);
+ 					convert_to_string(&copyval);
+ 					if (libssh2_channel_setenv_ex(channel, key->val, key->len, Z_STRVAL(copyval), Z_STRLEN(copyval))) {
+-						php_error_docref(NULL, E_WARNING, "Failed setting %s=%s on remote end", key, Z_STRVAL(copyval));
++						php_error_docref(NULL, E_WARNING, "Failed setting %s=%s on remote end", ZSTR_VAL(key), Z_STRVAL(copyval));
+ 					}
+ 					zval_dtor(&copyval);
+ 				}
+@@ -878,7 +893,7 @@ static php_stream *php_ssh2_fopen_wrapper_exec(php_stream_wrapper *wrapper, cons
+ 		zval_ptr_dtor(copyval);
+ 	}
+ 
+-	stream = php_ssh2_exec_command(session, resource_id, resource->path + 1, terminal, terminal_len, environment, width, height, type);
++	stream = php_ssh2_exec_command(session, resource_id, SSH2_URL_STR(resource->path) + 1, terminal, terminal_len, environment, width, height, type);
+ 	if (!stream) {
+ 		// TODO Sean-Der
+ 		//zend_list_delete(resource_id);
+@@ -1021,7 +1036,7 @@ static php_stream *php_ssh2_fopen_wrapper_scp(php_stream_wrapper *wrapper, const
+ 		return NULL;
+ 	}
+ 
+-	stream = php_ssh2_scp_xfer(session, resource_id, resource->path);
++	stream = php_ssh2_scp_xfer(session, resource_id, SSH2_URL_STR(resource->path));
+ 	if (!stream) {
+ 		//TODO Sean-Der
+ 		//zend_list_delete(resource_id);
+@@ -1147,7 +1162,7 @@ PHP_FUNCTION(ssh2_scp_send)
+ 		char *error_msg = NULL;
+ 
+ 		last_error = libssh2_session_last_error(session, &error_msg, NULL, 0);
+-		php_error_docref(NULL, E_WARNING, "Failure creating remote file: %s", error_msg);
++		php_error_docref(NULL, E_WARNING, "Failure creating remote file: %s (%d)", error_msg, last_error);
+ 		php_stream_close(local_file);
+ 		RETURN_FALSE;
+ 	}
+@@ -1262,10 +1277,10 @@ static php_stream *php_ssh2_fopen_wrapper_tunnel(php_stream_wrapper *wrapper, co
+ 		return NULL;
+ 	}
+ 
+-	if (resource->path && resource->path[0] == '/') {
++	if (resource->path && SSH2_URL_STR(resource->path)[0] == '/') {
+ 		char *colon;
+ 
+-		host = resource->path + 1;
++		host = SSH2_URL_STR(resource->path) + 1;
+ 		if (*host == '[') {
+ 			/* IPv6 Encapsulated Format */
+ 			host++;
+diff --git a/ssh2_sftp.c b/ssh2_sftp.c
+index 13f89f0..6332be8 100644
+--- a/ssh2_sftp.c
++++ b/ssh2_sftp.c
+@@ -238,7 +238,7 @@ static php_stream *php_ssh2_sftp_stream_opener(php_stream_wrapper *wrapper, cons
+ 
+ 	flags = php_ssh2_parse_fopen_modes((char *)mode);
+ 
+-	handle = libssh2_sftp_open(sftp, resource->path, flags, perms);
++	handle = libssh2_sftp_open(sftp, SSH2_URL_STR(resource->path), flags, perms);
+ 	if (!handle) {
+ 		php_error_docref(NULL, E_WARNING, "Unable to open %s on remote host", filename);
+ 		php_url_free(resource);
+@@ -341,7 +341,7 @@ static php_stream *php_ssh2_sftp_dirstream_opener(php_stream_wrapper *wrapper, c
+ 		return NULL;
+ 	}
+ 
+-	handle = libssh2_sftp_opendir(sftp, resource->path);
++	handle = libssh2_sftp_opendir(sftp, SSH2_URL_STR(resource->path));
+ 	if (!handle) {
+ 		php_error_docref(NULL, E_WARNING, "Unable to open %s on remote host", filename);
+ 		php_url_free(resource);
+@@ -386,7 +386,7 @@ static int php_ssh2_sftp_urlstat(php_stream_wrapper *wrapper, const char *url, i
+ 		return -1;
+ 	}
+ 
+-	if (libssh2_sftp_stat_ex(sftp, resource->path, strlen(resource->path),
++	if (libssh2_sftp_stat_ex(sftp, SSH2_URL_STR(resource->path), SSH2_URL_LEN(resource->path),
+ 		(flags & PHP_STREAM_URL_STAT_LINK) ? LIBSSH2_SFTP_LSTAT : LIBSSH2_SFTP_STAT, &attrs)) {
+ 		php_url_free(resource);
+ 		//zend_list_delete(sftp_rsrcid);
+@@ -420,7 +420,7 @@ static int php_ssh2_sftp_unlink(php_stream_wrapper *wrapper, const char *url, in
+ 		return 0;
+ 	}
+ 
+-	result = libssh2_sftp_unlink(sftp, resource->path);
++	result = libssh2_sftp_unlink(sftp, SSH2_URL_STR(resource->path));
+ 	php_url_free(resource);
+ 
+ 	//zend_list_delete(sftp_rsrcid);
+@@ -462,7 +462,7 @@ static int php_ssh2_sftp_rename(php_stream_wrapper *wrapper, const char *url_fro
+ 		return 0;
+ 	}
+ 
+-	result = libssh2_sftp_rename(sftp, resource->path, resource_to->path);
++	result = libssh2_sftp_rename(sftp, SSH2_URL_STR(resource->path), SSH2_URL_STR(resource_to->path));
+ 	php_url_free(resource);
+ 	php_url_free(resource_to);
+ 
+@@ -493,13 +493,13 @@ static int php_ssh2_sftp_mkdir(php_stream_wrapper *wrapper, const char *url, int
+ 
+ 	if (options & PHP_STREAM_MKDIR_RECURSIVE) {
+ 		/* Just attempt to make every directory, some will fail, but we only care about the last success/failure */
+-		char *p = resource->path;
++		char *p = SSH2_URL_STR(resource->path);
+ 		while ((p = strchr(p + 1, '/'))) {
+-			libssh2_sftp_mkdir_ex(sftp, resource->path, p - resource->path, mode);
++			libssh2_sftp_mkdir_ex(sftp, SSH2_URL_STR(resource->path), p - SSH2_URL_STR(resource->path), mode);
+ 		}
+ 	}
+ 
+-	result = libssh2_sftp_mkdir(sftp, resource->path, mode);
++	result = libssh2_sftp_mkdir(sftp, SSH2_URL_STR(resource->path), mode);
+ 	php_url_free(resource);
+ 
+ 	//zend_list_delete(sftp_rsrcid);
+@@ -527,7 +527,7 @@ static int php_ssh2_sftp_rmdir(php_stream_wrapper *wrapper, const char *url, int
+ 		return 0;
+ 	}
+ 
+-	result = libssh2_sftp_rmdir(sftp, resource->path);
++	result = libssh2_sftp_rmdir(sftp, SSH2_URL_STR(resource->path));
+ 	php_url_free(resource);
+ 
+ 	//zend_list_delete(sftp_rsrcid);
+@@ -836,7 +836,7 @@ PHP_FUNCTION(ssh2_sftp_readlink)
+ 	}
+ 
+ 	if ((targ_len = libssh2_sftp_symlink_ex(data->sftp, link->val, link->len, targ, 8192, LIBSSH2_SFTP_READLINK)) < 0) {
+-		php_error_docref(NULL, E_WARNING, "Unable to read link '%s'", link);
++		php_error_docref(NULL, E_WARNING, "Unable to read link '%s'", ZSTR_VAL(link));
+ 		RETURN_FALSE;
+ 	}
+ 
+-- 
+2.1.4
+

diff --git a/dev-php/pecl-ssh2/pecl-ssh2-1.1.2.ebuild b/dev-php/pecl-ssh2/pecl-ssh2-1.1.2.ebuild
index 619e242eff1..7001e2010d5 100644
--- a/dev-php/pecl-ssh2/pecl-ssh2-1.1.2.ebuild
+++ b/dev-php/pecl-ssh2/pecl-ssh2-1.1.2.ebuild
@@ -1,15 +1,15 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI="7"
 
 PHP_EXT_NAME="ssh2"
 
-USE_PHP="php5-6 php7-0 php7-1 php7-2"
+USE_PHP="php5-6 php7-1 php7-2 php7-3"
 
 inherit php-ext-pecl-r3
 
-USE_PHP="php7-0 php7-1 php7-2"
+USE_PHP="php7-1 php7-2 php7-3"
 
 DESCRIPTION="PHP bindings for the libssh2 library"
 LICENSE="PHP-3.01"
@@ -21,8 +21,13 @@ DEPEND=">=net-libs/libssh2-1.2[-gcrypt]"
 RDEPEND="${DEPEND}
 	php_targets_php5-6? ( dev-php/pecl-ssh2:0[php_targets_php5-6] )"
 
+PATCHES=(
+	"${FILESDIR}"/${P}-fix-php_url-fields-usage-for-php7-3.patch
+	"${FILESDIR}"/${P}-fix-php7-port.patch
+)
+
 src_prepare() {
-	if use php_targets_php7-0 || use php_targets_php7-1 || use php_targets_php7-2; then
+	if use php_targets_php7-1 || use php_targets_php7-2 || use php_targets_php7-3; then
 		php-ext-source-r3_src_prepare
 	else
 		default_src_prepare

diff --git a/dev-php/pecl-ssh2/pecl-ssh2-9999.ebuild b/dev-php/pecl-ssh2/pecl-ssh2-9999.ebuild
index e493a7b71a8..72ef46fdff1 100644
--- a/dev-php/pecl-ssh2/pecl-ssh2-9999.ebuild
+++ b/dev-php/pecl-ssh2/pecl-ssh2-9999.ebuild
@@ -1,16 +1,16 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI="7"
 
 PHP_EXT_NAME="ssh2"
 
-USE_PHP="php5-6 php7-0 php7-1 php7-2"
+USE_PHP="php5-6 php7-1 php7-2 php7-3"
 EGIT_REPO_URI="https://git.php.net/repository/pecl/networking/ssh2.git"
 
 inherit php-ext-source-r3 git-r3
 
-USE_PHP="php7-0 php7-1 php7-2"
+USE_PHP="php7-1 php7-2 php7-3"
 
 DESCRIPTION="PHP bindings for the libssh2 library"
 LICENSE="PHP-3.01"
@@ -23,7 +23,7 @@ RDEPEND="${DEPEND}
 HOMEPAGE="https://pecl.php.net/package/ssh2"
 
 src_prepare() {
-	if use php_targets_php7-0 || use php_targets_php7-1 || use php_targets_php7-2 ; then
+	if use php_targets_php7-1 || use php_targets_php7-2 || use php_targets_php7-3 ; then
 		php-ext-source-r3_src_prepare
 	else
 		default_src_prepare


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-php/pecl-ssh2/, dev-php/pecl-ssh2/files/
@ 2021-09-23 14:44 Brian Evans
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Evans @ 2021-09-23 14:44 UTC (permalink / raw
  To: gentoo-commits

commit:     41c7e35cc617c5b79089ab4af123f2b5bac1f1b2
Author:     Brian Evans <grknight <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 23 14:41:24 2021 +0000
Commit:     Brian Evans <grknight <AT> gentoo <DOT> org>
CommitDate: Thu Sep 23 14:41:24 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=41c7e35c

dev-php/pecl-ssh2: Drop old

Signed-off-by: Brian Evans <grknight <AT> gentoo.org>

 dev-php/pecl-ssh2/Manifest                         |   3 -
 ...1.1.2-fix-php_url-fields-usage-for-php7-3.patch | 302 ---------------------
 dev-php/pecl-ssh2/pecl-ssh2-1.1.2.ebuild           |  36 ---
 dev-php/pecl-ssh2/pecl-ssh2-1.2.ebuild             |  33 ---
 4 files changed, 374 deletions(-)

diff --git a/dev-php/pecl-ssh2/Manifest b/dev-php/pecl-ssh2/Manifest
index 4a420e281de..0d800ebf183 100644
--- a/dev-php/pecl-ssh2/Manifest
+++ b/dev-php/pecl-ssh2/Manifest
@@ -1,4 +1 @@
-DIST pecl-ssh2-1.1.2-fix-php7-port.patch 27860 BLAKE2B 23054187608bdcf79f53ce638e37c646f44297aa7d1e8f7a7c85fd922977ab835b915d541fbae327a30d2e863b503ed4822a82c1b242346290ceb94d49c97020 SHA512 1c2ecc990323a77fb2b69be0d6649f96dd7ad2d06c62f4fcb79a9ef4f89e066d463301668a044d37d717c99837c5d7d3f621f61119543445bd05c3229d9270e9
-DIST pecl-ssh2-1.2.tar.gz 32447 BLAKE2B 3a9d0f205097a381d07fb9dd5ab4dcb8e361f555dbc633abb8fa895c83024b70e85cd87602da1ceeb1018a7b07c474720b02810ef0689e9294fc33b129b6c738 SHA512 7b7d311cd5f88835e124d70a0295468f75d0fa6936a58808c936d1a185bb630b9e02c21f49b4bd777194a7b104aa3ff85c4fbf480f43d5906787e532ba2d3e04
-DIST ssh2-1.1.2.tgz 32057 BLAKE2B 88ffb3fb608687a086bbe345677982e944210791acc100312ba56ac7c35188a52cde5529d78caf473d19710e9965fba853ea9ff046715413a0b488ae2d8b690c SHA512 36793191448745b8a9b3cc628fe9fb431480792c7a2ff0bf2eccd58cda1cf944933be1d301c455d4a6f3dabf7e04ffef248bc402a8ff99bfafcba0deddb25c36
 DIST ssh2-1.3.1.tgz 33838 BLAKE2B 05976ad143563fd9d51be3f8e23b5b22099e351d6f252b612aa1dcb56648dc337b623d2cddf7b9079f3e07c879ca69215a1987cd6f4326f97ba134e13c6d28e7 SHA512 c74d4f699853148b53cdca0eaf8837bfdbdd21d185761606acadf2442e84dbefdb00cde207e0ce4794ae1e4f8692a38ed903b6d11fdc57bca7b54a4250da9a76

diff --git a/dev-php/pecl-ssh2/files/pecl-ssh2-1.1.2-fix-php_url-fields-usage-for-php7-3.patch b/dev-php/pecl-ssh2/files/pecl-ssh2-1.1.2-fix-php_url-fields-usage-for-php7-3.patch
deleted file mode 100644
index 1f135256422..00000000000
--- a/dev-php/pecl-ssh2/files/pecl-ssh2-1.1.2-fix-php_url-fields-usage-for-php7-3.patch
+++ /dev/null
@@ -1,302 +0,0 @@
-From a8835aab2c15e794fce13bd927295719e384ad2d Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@php.net>
-Date: Thu, 28 Jun 2018 07:10:35 +0200
-Subject: [PATCH] fix php_url fields usage for PHP 7.3
-
----
- php_ssh2.h            |  8 ++++++++
- ssh2_fopen_wrappers.c | 55 ++++++++++++++++++++++++++++++++-------------------
- ssh2_sftp.c           | 20 +++++++++----------
- 3 files changed, 53 insertions(+), 30 deletions(-)
-
-diff --git a/php_ssh2.h b/php_ssh2.h
-index 734b795..d010ff9 100644
---- a/php_ssh2.h
-+++ b/php_ssh2.h
-@@ -166,6 +166,14 @@ extern php_stream_wrapper php_ssh2_sftp_wrapper;
- extern int le_ssh2_session;
- extern int le_ssh2_sftp;
- 
-+#if PHP_VERSION_ID < 70300
-+#define SSH2_URL_STR(a) (a)
-+#define SSH2_URL_LEN(a) strlen(a)
-+#else
-+#define SSH2_URL_STR(a) ZSTR_VAL(a)
-+#define SSH2_URL_LEN(a) ZSTR_LEN(a)
-+#endif
-+
- #endif	/* PHP_SSH2_H */
- 
- /*
-diff --git a/ssh2_fopen_wrappers.c b/ssh2_fopen_wrappers.c
-index 2f96ca4..f2f3475 100644
---- a/ssh2_fopen_wrappers.c
-+++ b/ssh2_fopen_wrappers.c
-@@ -215,7 +215,7 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
- 	php_url *resource;
- 	zval *methods = NULL, *callbacks = NULL, zsession, *tmpzval;
- 	zend_long resource_id;
--	char *h, *s, *username = NULL, *password = NULL, *pubkey_file = NULL, *privkey_file = NULL;
-+	char *h, *username = NULL, *password = NULL, *pubkey_file = NULL, *privkey_file = NULL;
- 	int username_len = 0, password_len = 0;
- 
- 	h = strstr(path, "Resource id #");
-@@ -233,13 +233,13 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
- 		return NULL;
- 	}
- 
--	if (strncmp(resource->scheme, "ssh2.", sizeof("ssh2.") - 1)) {
-+	if (strncmp(SSH2_URL_STR(resource->scheme), "ssh2.", sizeof("ssh2.") - 1)) {
- 		/* Not an ssh wrapper */
- 		php_url_free(resource);
- 		return NULL;
- 	}
- 
--	if (strcmp(resource->scheme + sizeof("ssh2.") - 1, type)) {
-+	if (strcmp(SSH2_URL_STR(resource->scheme) + sizeof("ssh2.") - 1, type)) {
- 		/* Wrong ssh2. wrapper type */
- 		php_url_free(resource);
- 		return NULL;
-@@ -253,13 +253,27 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
- 		Find resource->path in the path string, then copy the entire string from the original path.
- 		This includes ?query#fragment in the path string
- 	*/
-+// TODO copy seems uneeded
-+#if PHP_VERSION_ID < 70300
-+	{
-+	char * s;
-+
- 	s = resource->path;
- 	resource->path = estrdup(strstr(path, resource->path));
- 	efree(s);
-+	}
-+#else
-+	{
-+	zend_string *tmp;
-+
-+	tmp = resource->path;
-+	resource->path = zend_string_init(ZSTR_VAL(resource->path), ZSTR_LEN(resource->path), 0);
-+	zend_string_release(tmp);
-+	}
-+#endif
- 
- 	/* Look for a resource ID to reuse a session */
--	s = resource->host;
--	if (is_numeric_string(s, strlen(s), &resource_id, NULL, 0) == IS_LONG) {
-+	if (is_numeric_string(SSH2_URL_STR(resource->host), SSH2_URL_LEN(resource->host), &resource_id, NULL, 0) == IS_LONG) {
- 		php_ssh2_sftp_data *sftp_data;
- 		zval *zresource;
- 
-@@ -309,7 +323,7 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
- 	}
- 
- 	/* Fallback on finding it in the context */
--	if (resource->host[0] == 0 && context && psftp &&
-+	if (SSH2_URL_STR(resource->host)[0] == 0 && context && psftp &&
- 		(tmpzval = php_stream_context_get_option(context, "ssh2", "sftp")) != NULL &&
- 		Z_TYPE_P(tmpzval) == IS_RESOURCE) {
- 		php_ssh2_sftp_data *sftp_data;
-@@ -323,7 +337,7 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
- 			return resource;
- 		}
- 	}
--	if (resource->host[0] == 0 && context &&
-+	if (SSH2_URL_STR(resource->host)[0] == 0 && context &&
- 		(tmpzval = php_stream_context_get_option(context, "ssh2", "session")) != NULL &&
- 		Z_TYPE_P(tmpzval) == IS_RESOURCE) {
- 		session = (LIBSSH2_SESSION *)zend_fetch_resource(Z_RES_P(tmpzval), PHP_SSH2_SESSION_RES_NAME, le_ssh2_session);
-@@ -399,19 +413,19 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
- 	}
- 
- 	if (resource->user) {
--		int len = strlen(resource->user);
-+		int len = SSH2_URL_LEN(resource->user);
- 
- 		if (len) {
--			username = resource->user;
-+			username = SSH2_URL_STR(resource->user);
- 			username_len = len;
- 		}
- 	}
- 
- 	if (resource->pass) {
--		int len = strlen(resource->pass);
-+		int len = SSH2_URL_LEN(resource->pass);
- 
- 		if (len) {
--			password = resource->pass;
-+			password = SSH2_URL_STR(resource->pass);
- 			password_len = len;
- 		}
- 	}
-@@ -422,7 +436,7 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
- 		return NULL;
- 	}
- 
--	session = php_ssh2_session_connect(resource->host, resource->port, methods, callbacks);
-+	session = php_ssh2_session_connect(SSH2_URL_STR(resource->host), resource->port, methods, callbacks);
- 	if (!session) {
- 		/* Unable to connect! */
- 		php_url_free(resource);
-@@ -482,6 +496,7 @@ session_authed:
- 		*psftp = sftp;
- 	}
- 
-+	//TODO may be undefined
- 	*presource_id = Z_LVAL(zsession);
- 	*psession = session;
- 
-@@ -527,7 +542,7 @@ static php_stream *php_ssh2_shell_open(LIBSSH2_SESSION *session, int resource_id
- 					zval_copy_ctor(&copyval);
- 					convert_to_string(&copyval);
- 					if (libssh2_channel_setenv_ex(channel, key->val, key->len, Z_STRVAL(copyval), Z_STRLEN(copyval))) {
--						php_error_docref(NULL, E_WARNING, "Failed setting %s=%s on remote end", key, Z_STRVAL(copyval));
-+						php_error_docref(NULL, E_WARNING, "Failed setting %s=%s on remote end", ZSTR_VAL(key), Z_STRVAL(copyval));
- 					}
- 					zval_dtor(&copyval);
- 				}
-@@ -631,7 +646,7 @@ static php_stream *php_ssh2_fopen_wrapper_shell(php_stream_wrapper *wrapper, con
- 		zval_ptr_dtor(&copyval);
- 	}
- 
--	s = resource->path ? resource->path : NULL;
-+	s = resource->path ? SSH2_URL_STR(resource->path) : NULL;
- 
- 	if (s && s[0] == '/') {
- 		/* Terminal type encoded into URL overrides context terminal type */
-@@ -766,7 +781,7 @@ static php_stream *php_ssh2_exec_command(LIBSSH2_SESSION *session, int resource_
- 					zval_copy_ctor(&copyval);
- 					convert_to_string(&copyval);
- 					if (libssh2_channel_setenv_ex(channel, key->val, key->len, Z_STRVAL(copyval), Z_STRLEN(copyval))) {
--						php_error_docref(NULL, E_WARNING, "Failed setting %s=%s on remote end", key, Z_STRVAL(copyval));
-+						php_error_docref(NULL, E_WARNING, "Failed setting %s=%s on remote end", ZSTR_VAL(key), Z_STRVAL(copyval));
- 					}
- 					zval_dtor(&copyval);
- 				}
-@@ -878,7 +893,7 @@ static php_stream *php_ssh2_fopen_wrapper_exec(php_stream_wrapper *wrapper, cons
- 		zval_ptr_dtor(copyval);
- 	}
- 
--	stream = php_ssh2_exec_command(session, resource_id, resource->path + 1, terminal, terminal_len, environment, width, height, type);
-+	stream = php_ssh2_exec_command(session, resource_id, SSH2_URL_STR(resource->path) + 1, terminal, terminal_len, environment, width, height, type);
- 	if (!stream) {
- 		// TODO Sean-Der
- 		//zend_list_delete(resource_id);
-@@ -1021,7 +1036,7 @@ static php_stream *php_ssh2_fopen_wrapper_scp(php_stream_wrapper *wrapper, const
- 		return NULL;
- 	}
- 
--	stream = php_ssh2_scp_xfer(session, resource_id, resource->path);
-+	stream = php_ssh2_scp_xfer(session, resource_id, SSH2_URL_STR(resource->path));
- 	if (!stream) {
- 		//TODO Sean-Der
- 		//zend_list_delete(resource_id);
-@@ -1147,7 +1162,7 @@ PHP_FUNCTION(ssh2_scp_send)
- 		char *error_msg = NULL;
- 
- 		last_error = libssh2_session_last_error(session, &error_msg, NULL, 0);
--		php_error_docref(NULL, E_WARNING, "Failure creating remote file: %s", error_msg);
-+		php_error_docref(NULL, E_WARNING, "Failure creating remote file: %s (%d)", error_msg, last_error);
- 		php_stream_close(local_file);
- 		RETURN_FALSE;
- 	}
-@@ -1262,10 +1277,10 @@ static php_stream *php_ssh2_fopen_wrapper_tunnel(php_stream_wrapper *wrapper, co
- 		return NULL;
- 	}
- 
--	if (resource->path && resource->path[0] == '/') {
-+	if (resource->path && SSH2_URL_STR(resource->path)[0] == '/') {
- 		char *colon;
- 
--		host = resource->path + 1;
-+		host = SSH2_URL_STR(resource->path) + 1;
- 		if (*host == '[') {
- 			/* IPv6 Encapsulated Format */
- 			host++;
-diff --git a/ssh2_sftp.c b/ssh2_sftp.c
-index 13f89f0..6332be8 100644
---- a/ssh2_sftp.c
-+++ b/ssh2_sftp.c
-@@ -238,7 +238,7 @@ static php_stream *php_ssh2_sftp_stream_opener(php_stream_wrapper *wrapper, cons
- 
- 	flags = php_ssh2_parse_fopen_modes((char *)mode);
- 
--	handle = libssh2_sftp_open(sftp, resource->path, flags, perms);
-+	handle = libssh2_sftp_open(sftp, SSH2_URL_STR(resource->path), flags, perms);
- 	if (!handle) {
- 		php_error_docref(NULL, E_WARNING, "Unable to open %s on remote host", filename);
- 		php_url_free(resource);
-@@ -341,7 +341,7 @@ static php_stream *php_ssh2_sftp_dirstream_opener(php_stream_wrapper *wrapper, c
- 		return NULL;
- 	}
- 
--	handle = libssh2_sftp_opendir(sftp, resource->path);
-+	handle = libssh2_sftp_opendir(sftp, SSH2_URL_STR(resource->path));
- 	if (!handle) {
- 		php_error_docref(NULL, E_WARNING, "Unable to open %s on remote host", filename);
- 		php_url_free(resource);
-@@ -386,7 +386,7 @@ static int php_ssh2_sftp_urlstat(php_stream_wrapper *wrapper, const char *url, i
- 		return -1;
- 	}
- 
--	if (libssh2_sftp_stat_ex(sftp, resource->path, strlen(resource->path),
-+	if (libssh2_sftp_stat_ex(sftp, SSH2_URL_STR(resource->path), SSH2_URL_LEN(resource->path),
- 		(flags & PHP_STREAM_URL_STAT_LINK) ? LIBSSH2_SFTP_LSTAT : LIBSSH2_SFTP_STAT, &attrs)) {
- 		php_url_free(resource);
- 		//zend_list_delete(sftp_rsrcid);
-@@ -420,7 +420,7 @@ static int php_ssh2_sftp_unlink(php_stream_wrapper *wrapper, const char *url, in
- 		return 0;
- 	}
- 
--	result = libssh2_sftp_unlink(sftp, resource->path);
-+	result = libssh2_sftp_unlink(sftp, SSH2_URL_STR(resource->path));
- 	php_url_free(resource);
- 
- 	//zend_list_delete(sftp_rsrcid);
-@@ -462,7 +462,7 @@ static int php_ssh2_sftp_rename(php_stream_wrapper *wrapper, const char *url_fro
- 		return 0;
- 	}
- 
--	result = libssh2_sftp_rename(sftp, resource->path, resource_to->path);
-+	result = libssh2_sftp_rename(sftp, SSH2_URL_STR(resource->path), SSH2_URL_STR(resource_to->path));
- 	php_url_free(resource);
- 	php_url_free(resource_to);
- 
-@@ -493,13 +493,13 @@ static int php_ssh2_sftp_mkdir(php_stream_wrapper *wrapper, const char *url, int
- 
- 	if (options & PHP_STREAM_MKDIR_RECURSIVE) {
- 		/* Just attempt to make every directory, some will fail, but we only care about the last success/failure */
--		char *p = resource->path;
-+		char *p = SSH2_URL_STR(resource->path);
- 		while ((p = strchr(p + 1, '/'))) {
--			libssh2_sftp_mkdir_ex(sftp, resource->path, p - resource->path, mode);
-+			libssh2_sftp_mkdir_ex(sftp, SSH2_URL_STR(resource->path), p - SSH2_URL_STR(resource->path), mode);
- 		}
- 	}
- 
--	result = libssh2_sftp_mkdir(sftp, resource->path, mode);
-+	result = libssh2_sftp_mkdir(sftp, SSH2_URL_STR(resource->path), mode);
- 	php_url_free(resource);
- 
- 	//zend_list_delete(sftp_rsrcid);
-@@ -527,7 +527,7 @@ static int php_ssh2_sftp_rmdir(php_stream_wrapper *wrapper, const char *url, int
- 		return 0;
- 	}
- 
--	result = libssh2_sftp_rmdir(sftp, resource->path);
-+	result = libssh2_sftp_rmdir(sftp, SSH2_URL_STR(resource->path));
- 	php_url_free(resource);
- 
- 	//zend_list_delete(sftp_rsrcid);
-@@ -836,7 +836,7 @@ PHP_FUNCTION(ssh2_sftp_readlink)
- 	}
- 
- 	if ((targ_len = libssh2_sftp_symlink_ex(data->sftp, link->val, link->len, targ, 8192, LIBSSH2_SFTP_READLINK)) < 0) {
--		php_error_docref(NULL, E_WARNING, "Unable to read link '%s'", link);
-+		php_error_docref(NULL, E_WARNING, "Unable to read link '%s'", ZSTR_VAL(link));
- 		RETURN_FALSE;
- 	}
- 
--- 
-2.1.4
-

diff --git a/dev-php/pecl-ssh2/pecl-ssh2-1.1.2.ebuild b/dev-php/pecl-ssh2/pecl-ssh2-1.1.2.ebuild
deleted file mode 100644
index a27f6970b15..00000000000
--- a/dev-php/pecl-ssh2/pecl-ssh2-1.1.2.ebuild
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-PHP_EXT_NAME="ssh2"
-
-USE_PHP="php5-6 php7-1 php7-2 php7-3"
-
-inherit php-ext-pecl-r3
-
-USE_PHP="php7-1 php7-2 php7-3"
-
-DESCRIPTION="PHP bindings for the libssh2 library"
-LICENSE="PHP-3.01"
-SLOT="7"
-
-SRC_URI+=" https://dev.gentoo.org/~juippis/distfiles/tmp/pecl-ssh2-1.1.2-fix-php7-port.patch"
-KEYWORDS="amd64 x86"
-# Upstream notes say there are errors with gcrypt backend
-DEPEND=">=net-libs/libssh2-1.2[-gcrypt]"
-RDEPEND="${DEPEND}
-	php_targets_php5-6? ( dev-php/pecl-ssh2:0[php_targets_php5-6] )"
-
-PATCHES=(
-	"${FILESDIR}"/${P}-fix-php_url-fields-usage-for-php7-3.patch
-	"${DISTDIR}"/${P}-fix-php7-port.patch
-)
-
-src_prepare() {
-	if use php_targets_php7-1 || use php_targets_php7-2 || use php_targets_php7-3; then
-		php-ext-source-r3_src_prepare
-	else
-		default_src_prepare
-	fi
-}

diff --git a/dev-php/pecl-ssh2/pecl-ssh2-1.2.ebuild b/dev-php/pecl-ssh2/pecl-ssh2-1.2.ebuild
deleted file mode 100644
index ffc132c9374..00000000000
--- a/dev-php/pecl-ssh2/pecl-ssh2-1.2.ebuild
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-PHP_EXT_NAME="ssh2"
-
-USE_PHP="php5-6 php7-1 php7-2 php7-3 php7-4"
-
-inherit php-ext-pecl-r3
-
-# https://pecl.php.net/get/ssh2-1.2.tgz isn't work for some weeks
-SRC_URI="https://dev.gentoo.org/~whissi/dist/${PN}/${P}.tar.gz"
-
-USE_PHP="php7-1 php7-2 php7-3 php7-4"
-
-DESCRIPTION="PHP bindings for the libssh2 library"
-LICENSE="PHP-3.01"
-SLOT="7"
-IUSE=""
-KEYWORDS="~amd64 ~x86"
-# Upstream notes say there are errors with gcrypt backend
-DEPEND=">=net-libs/libssh2-1.2[-gcrypt]"
-RDEPEND="${DEPEND}
-	php_targets_php5-6? ( dev-php/pecl-ssh2:0[php_targets_php5-6] )"
-
-src_prepare() {
-	if use php_targets_php7-1 || use php_targets_php7-2 || use php_targets_php7-3 || use php_targets_php7-4 ; then
-		php-ext-source-r3_src_prepare
-	else
-		default_src_prepare
-	fi
-}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-23 14:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-07 14:14 [gentoo-commits] repo/gentoo:master commit in: dev-php/pecl-ssh2/, dev-php/pecl-ssh2/files/ Thomas Deutschmann
  -- strict thread matches above, loose matches on Subject: below --
2021-09-23 14:44 Brian Evans
2017-07-05  2:28 Brian Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox