Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7.4 support #999

Closed
remicollet opened this issue Jun 5, 2019 · 25 comments
Closed

PHP 7.4 support #999

remicollet opened this issue Jun 5, 2019 · 25 comments

Comments

@remicollet
Copy link

For now, build fails

/dev/shm/BUILD/php74-php-sqlsrv-5.6.1/NTS/sqlsrv/shared/core_sqlsrv.h: In function 'void core::sqlsrv_add_index_zval(sqlsrv_context&, zval*, zend_ulong, zval*)':
/opt/remi/php74/root/usr/include/php/Zend/zend_API.h:421:2: error: expected id-expression before '(' token
  (zend_hash_index_update(Z_ARRVAL_P(arg), index, value) ? SUCCESS : FAILURE)
  ^
/dev/shm/BUILD/php74-php-sqlsrv-5.6.1/NTS/sqlsrv/shared/core_sqlsrv.h:2405:20: note: in expansion of macro 'add_index_zval'
         int zr = ::add_index_zval( array, index, value );
                    ^~~~~~~~~~~~~~
/dev/shm/BUILD/php74-php-sqlsrv-5.6.1/NTS/sqlsrv/shared/core_sqlsrv.h: In function 'void core::sqlsrv_add_next_index_zval(sqlsrv_context&, zval*, zval*)':
/opt/remi/php74/root/usr/include/php/Zend/zend_API.h:433:2: error: expected id-expression before '(' token
  (zend_hash_next_index_insert(Z_ARRVAL_P(arg), value) ? SUCCESS : FAILURE)
  ^
/dev/shm/BUILD/php74-php-sqlsrv-5.6.1/NTS/sqlsrv/shared/core_sqlsrv.h:2413:20: note: in expansion of macro 'add_next_index_zval'
         int zr = ::add_next_index_zval( array, value );
                    ^~~~~~~~~~~~~~~~~~~

@cmb69
Copy link

cmb69 commented Jun 5, 2019

add_next_index_zval has been replaced by a macro. That doesn't seem to be mentioned in UPGRADING.INTERNALS, though.

@yitam
Copy link
Contributor

yitam commented Jun 5, 2019

Thanks @remicollet and @cmb69
We will investigate and get back to you.

@cmb69
Copy link

cmb69 commented Jun 13, 2019

This issue might get resolved on the PHP side, see php/php-src#4250.

@yitam
Copy link
Contributor

yitam commented Jun 14, 2019

Thanks @cmb69 for the reference! We will keep an eye on this.

@remicollet
Copy link
Author

FYI, I confirm than 5.6.1 build without error against 7.4.0-dev (so with upcoming alpha2)

@remicollet
Copy link
Author

For memory, if someone need to build against alpha1, here is a small workaround
https://git.remirepo.net/cgit/rpms/php/php-sqlsrv.git/plain/shared.patch

@yitam
Copy link
Contributor

yitam commented Jun 14, 2019

Cool! Thanks @remicollet and @cmb69 !

@celsowm
Copy link

celsowm commented Jul 13, 2019

Hi guys ! @remicollet, @cmb69 and @yitam
Do you guys have a 64bits windows dll for PHP 7.4?

Thanks in advance !

@cmb69
Copy link

cmb69 commented Jul 15, 2019

The PHP for Windows team is planning to provide PECL DLLs for PHP 7.4 starting around beta1.

@yitam
Copy link
Contributor

yitam commented Jul 15, 2019

Thanks @cmb69 for the heads up.

Hi @celsowm if you're asking about the php drivers for SQL Server, we will test if v5.6.1 supports PHP 7.4 beta versions. If not, we tentatively plan to release a preview that will be compatible.

@Jan-E
Copy link

Jan-E commented Jul 23, 2019

The PHP for Windows team is planning to provide PECL DLLs for PHP 7.4 starting around beta1.

Alas. It fails in 7.4-beta1 now:

ext\sqlsrv\shared\core_stream.cpp(201): error C2078: too many initializers
ext\sqlsrv\shared\core_stream.cpp(201): error C2440: 'initializing': cannot convert from 'size_t (__cdecl *(php_stream *,char *,size_t)' to 'SSIZE_T (__cdecl *)(php_stream *,char *,size_t)'

This was after replacing some instances of 'uint' by 'unsigned long' in the 5.6.1 release, but in git head the error is the same.

The error was introduced in 7.4-beta1. 7.4-alpha3 still compiled OK. I do not know what caused the error.
@cmb69 Is it documented in UPGRADING.INTERNALS?

@Jan-E
Copy link

Jan-E commented Jul 23, 2019

Could it be this change php/php-src@845d07b#diff-2e4b71f255095863524bb18e8e26b815 ?
Then @nikic documented it yesterday.

@Jan-E
Copy link

Jan-E commented Jul 23, 2019

@nikic I had just noticed that too

@yitam
Copy link
Contributor

yitam commented Jul 23, 2019

Thanks @Jan-E and @nikic for the info. As mentioned above we tentatively plan to release a preview that supports PHP 7.4 beta or RC.

@Jan-E
Copy link

Jan-E commented Jul 23, 2019

Hi guys ! @remicollet, @cmb69 and @yitam
Do you guys have a 64bits windows dll for PHP 7.4?

You could try the ones in the Alpha3 zips here:
https://www.apachelounge.com/viewtopic.php?t=6617

@Jan-E
Copy link

Jan-E commented Jul 23, 2019

Looks like somethin like this fixes the compilation error:

diff --git a/source/shared/core_stream.cpp b/source/shared/core_stream.cpp
index 7d0e1be..6d3453b 100644
--- a/source/shared/core_stream.cpp
+++ b/source/shared/core_stream.cpp
@@ -44,7 +44,11 @@ int sqlsrv_stream_close( _Inout_ php_stream* stream, int /*close_handle*/ TSRMLS
 // read from a sqlsrv stream into the buffer provided by Zend.  The parameters for binary vs. char are
 // set when sqlsrv_get_field is called by the user specifying which field type they want.
 
+#if PHP_VERSION_ID >= 70400
+ssize_t sqlsrv_stream_read( _Inout_ php_stream* stream, _Out_writes_bytes_(count) char* buf, _Inout_ size_t count TSRMLS_DC )
+#else
 size_t sqlsrv_stream_read( _Inout_ php_stream* stream, _Out_writes_bytes_(count) char* buf, _Inout_ size_t count TSRMLS_DC )
+#endif
 {
 	SQLLEN read = 0;
     SQLSMALLINT c_type = SQL_C_CHAR;

@yitam
Copy link
Contributor

yitam commented Jul 23, 2019

Thanks again @Jan-E

@Jan-E
Copy link

Jan-E commented Jul 23, 2019

I only fixed the compilation error. Testing etc is up to you.

@yitam
Copy link
Contributor

yitam commented Jul 23, 2019

Of course, @Jan-E :-)

Yet it's unlikely we will release a preview just to fix this compilation issue. The preview will include new feature(s) as well. Thanks!

@remicollet
Copy link
Author

see pr #1013

stronk7 added a commit to stronk7/moodle-php-apache that referenced this issue Jul 28, 2019
php74beta1 broke sqlsrv, that's being tracked @ microsoft/msphpsql#999
stronk7 added a commit to stronk7/moodle-php-apache that referenced this issue Jul 28, 2019
php74beta1 broke sqlsrv, that's being tracked @ microsoft/msphpsql#999
@yitam
Copy link
Contributor

yitam commented Sep 11, 2019

Closing this issue as 5.7.0 preview is already released.

@yitam yitam closed this as completed Sep 11, 2019
@iluuu1994
Copy link

@yitam That's great! When is 5.7.0 scheduled to be release? This is the only thing keeping us from migrating to PHP 7.4. Thanks!

@yitam
Copy link
Contributor

yitam commented Jan 10, 2020

@iluuu1994 it depends on ODBC driver. We will likely release shortly afterwards, ETA as indicated here

@iluuu1994
Copy link

@yitam I see. Thank you for your response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants