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.0-Linux sqlsrv_query produces floating point exception when bind parameter is a empty string #144

Closed
xalopp opened this issue Sep 4, 2016 · 5 comments

Comments

@xalopp
Copy link

xalopp commented Sep 4, 2016

While this query worked fine with version 4.0.2 of sqlsrv

sqlsrv_query($conn, 'SELECT ?', ['']);

version 4.0.3 will produce a floating point exception for the same query.

Core was generated by `/usr/bin/php7.0 -n -c /vagrant/msphpsql/source/sqlsrv/tmp-php.ini -d output_han'.
Program terminated with signal SIGFPE, Arithmetic exception.
#0  0x00007f4d923dd0c6 in (anonymous namespace)::default_sql_size_and_scale (param_z=0x7f4d9265cf68, param_z=0x7f4d9265cf68, 
    decimal_digits=<synthetic pointer>, column_size=<synthetic pointer>, encoding=SQLSRV_ENCODING_CHAR, paramno=3, stmt=0x7f4d9266e000)
    at /vagrant/msphpsql/source/sqlsrv/core_stmt.cpp:1963
1963                    column_size = SQL_SERVER_MAX_FIELD_SIZE / char_size;

char_size is defined in line 1957, an will be 0 if Z_STRLEN_P( param_z ) is zero, which happens for an empty string.

My Environment:
Ubuntu 16.04 LTSUbuntu 16.04 LTS
PHP 7.0.10-1+deb.sury.org~xenial+1 (cli) ( NTS )PHP 7.0.10-1+deb.sury.org~xenial+1 (cli) ( NTS )

This issue is similar to #141 where pdo_sqlsrv is affected.

PR is in Progress.

@sirio3mil
Copy link

Same for me.

CentOS Linux release 7.2.1511 (Core)
PHP 7.0.10 (cli) (built: Sep 1 2016 10:36:29) ( NTS )
SQLSRV driver 4.0.3.0

Regards

@meet-bhagdev
Copy link
Contributor

@sirio3mil, @xalopp : We believe we have a fix for this and are validating it in our test labs. Stay tuned :)

@xalopp
Copy link
Author

xalopp commented Sep 7, 2016

@meet-bhagdev could you add some (regression) tests to each fixes, like in PR #145? This will make the fixes more transparent and prevent regressions.

@meet-bhagdev
Copy link
Contributor

@xalopp Sure thing! Will get it added to our test lab.

@xalopp
Copy link
Author

xalopp commented Sep 14, 2016

4ccffbb fixes this issues 👍

@xalopp xalopp closed this as completed Sep 14, 2016
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

3 participants