php / pecl-networking-ssh2

Bindings for the libssh2 library
http://pecl.php.net/package/ssh2
Other
51 stars 61 forks source link

Fix for PHP 7.4 and 8 #44

Closed remicollet closed 3 years ago

remicollet commented 4 years ago

This PR includes commits from PR #42

PHP_VERSION : 8.0.0beta3

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   17
---------------------------------------------------------------------

Number of tests :    7                 7
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    0 (  0.0%) (  0.0%)
Tests passed    :    7 (100.0%) (100.0%)
---------------------------------------------------------------------
Time taken      :    2 seconds
=====================================================================
andypost commented 4 years ago

@remicollet thank you, will test on musl

Jan-E commented 4 years ago

It works for PHP8 beta 4 on Windows as well.

Alion548 commented 4 years ago

It works for me! PHP8 RC2

glensc commented 4 years ago

Looking forward for merge and new release!

Alion548 commented 3 years ago

Looking forward for merge and new release!

braceyourself commented 3 years ago

Works for me as well!

Jan-E commented 3 years ago

@langemeijer Can you merge this PR?

ajardin commented 3 years ago

Hello,

Sorry to jump into the discussion. I wanted to know if this PR will provide a solution to my issue with installing the ssh2 extension on PHP 8.0. I suppose it will, but I'm not against a confirmation. 🙂

$ docker run -it php:7.4-cli-alpine sh -c 'apk add --no-cache $PHPIZE_DEPS libssh2-dev && yes "" | pecl install ssh2-1.2 && docker-php-ext-enable ssh2 && php -m'

[...]

[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
ssh2
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]
$ docker run -it php:8.0-cli-alpine sh -c 'apk add --no-cache $PHPIZE_DEPS libssh2-dev && yes "" | pecl install ssh2-1.2 && docker-php-ext-enable ssh2 && php -m'

[...]

running: make
/bin/sh /tmp/pear/temp/pear-build-defaultusergOfllF/ssh2-1.2/libtool --mode=compile cc -I. -I/tmp/pear/temp/ssh2 -I/tmp/pear/temp/pear-build-defaultusergOfllF/ssh2-1.2/include -I/tmp/pear/temp/pear-build-defaultusergOfllF/ssh2-1.2/main -I/tmp/pear/temp/ssh2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2    -c /tmp/pear/temp/ssh2/ssh2.c -o ssh2.lo
mkdir .libs
 cc -I. -I/tmp/pear/temp/ssh2 -I/tmp/pear/temp/pear-build-defaultusergOfllF/ssh2-1.2/include -I/tmp/pear/temp/pear-build-defaultusergOfllF/ssh2-1.2/main -I/tmp/pear/temp/ssh2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/ssh2/ssh2.c  -fPIC -DPIC -o .libs/ssh2.o
/tmp/pear/temp/ssh2/ssh2.c:49:2: warning: implicit declaration of function 'ZEND_ARG_PASS_INFO'; did you mean 'ZEND_ARG_TYPE_INFO'? [-Wimplicit-function-declaration]
   49 |  ZEND_ARG_PASS_INFO(1)
      |  ^~~~~~~~~~~~~~~~~~
      |  ZEND_ARG_TYPE_INFO
/tmp/pear/temp/ssh2/ssh2.c:49:2: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
/tmp/pear/temp/ssh2/ssh2.c:49:2: note: (near initialization for 'php_ssh2_first_arg_force_ref[1].name')
/tmp/pear/temp/ssh2/ssh2.c:49:2: error: initializer element is not constant
/tmp/pear/temp/ssh2/ssh2.c:49:2: note: (near initialization for 'php_ssh2_first_arg_force_ref[1].name')
/tmp/pear/temp/ssh2/ssh2.c: In function 'php_ssh2_debug_cb':
/tmp/pear/temp/ssh2/ssh2.c:103:17: warning: implicit declaration of function 'call_user_function_ex'; did you mean 'call_user_function'? [-Wimplicit-function-declaration]
  103 |  if (FAILURE == call_user_function_ex(NULL, NULL, data->disconnect_cb, NULL, 3, args, 0, NULL)) {
      |                 ^~~~~~~~~~~~~~~~~~~~~
      |                 call_user_function
/tmp/pear/temp/ssh2/ssh2.c: In function 'zif_ssh2_disconnect':
/tmp/pear/temp/ssh2/ssh2.c:443:6: error: void value not ignored as it ought to be
  443 |  if (zend_list_close(Z_RES_P(zsession)) != SUCCESS) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/pear/temp/ssh2/ssh2.c:443:41: error: invalid operands to binary != (have 'const zend_internal_arg_info[1]' {aka 'const struct _zend_internal_arg_info[1]'} and 'int')
  443 |  if (zend_list_close(Z_RES_P(zsession)) != SUCCESS) {
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~
      |      |
      |      void
make: *** [Makefile:209: ssh2.lo] Error 1
ERROR: `make' failed
L3o-pold commented 3 years ago

@ajardin you will need to use ssh2-1.3 when it will be release.

Jan-E commented 3 years ago

The compile fails at line 43 of ssh2.c. @remicollet changed that line: https://github.com/php/pecl-networking-ssh2/pull/44/files#diff-875780fa372112ee4a64b8c41e0052cf1a8448bd650bd0b7584a76061399ba7fL443

Moreover, @remicollet is more of a Linux man than a Windows one, so I suppose it will work OK. I can confirm it works OK on Windows with libssh2/1.9.0.

ajardin commented 3 years ago

@ajardin you will need to use ssh2-1.3 when it will be release.

Yep, no worries. I just wasn't sure I was in the right place. 😄

vtiertant commented 3 years ago

@ajardin you will need to use ssh2-1.3 when it will be release.

@L3o-pold @remicollet : if i understand, we can't yet use ssh2 wih pecl install for php8 ? We have to wait the release ssh2-1.3 ? Any idea of the release date ?

Is there any other way to use ssh2 with php8 ? This is my only blocking point to migrate to php8 :(

Jan-E commented 3 years ago

Is there any other way to use ssh2 with php8 ?

Compile it yourself?

langemeijer commented 3 years ago

I will be merging and releasing today/tomorrow.

vtiertant commented 3 years ago

I will be merging and releasing today/tomorrow.

great, thanks !

vtiertant commented 3 years ago

Hello @langemeijer ,

Is a new release planned for php8 with a new tag ?

I saw that it was commit on master.

Thx

langemeijer commented 3 years ago

Working on it. I wanted to make a new release containing all PR's but I'm in doubt about the last open PR. There will be a release soon.

ryandesign commented 3 years ago

We still await a php8-compatible release.

While I understand the desire to release all known fixes, releasing some fixes is still better than releasing no fixes.

mlocati commented 3 years ago

Just one question: at https://pecl.php.net/package/ssh2 we have the the destination of the "Browse Source" link is http://git.php.net/?p=pecl/networking/ssh2.git;a=summary Should it be updated to https://github.com/php/pecl-networking-ssh2 ?