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

SEGMENTATION FAULT when using array with keys #1465

Open
GDmac opened this issue Jul 27, 2023 · 3 comments
Open

SEGMENTATION FAULT when using array with keys #1465

GDmac opened this issue Jul 27, 2023 · 3 comments

Comments

@GDmac
Copy link

GDmac commented Jul 27, 2023

Possible fix: This should throw an Exception not a hard crash on SEGMENTATION FAULT

When parameter is an array with string keys,
the driver crashes hard with a segmentation fault.
php 7.4 driver 5.10 but this seems NOT fixed in later recent drivers (not tested).

$params = [ 442502 ];
// bool true

$params = [ array(442502) ];
// bool true

$params = [ array('id' => 442502) ];
// SQLerror: Parameter array 1 must have at least one value or variable

$params = [ array('id' => 442502, 'foo' => 'bar') ];
// SEGMENTATION FAULT: 11 !!!!!

$res = sqlsrv_query($conn, "SELECT id FROM product WHERE id = ?", $params);
if (sqlsrv_errors()) var_dump(sqlsrv_errors());
var_dump(sqlsrv_has_rows($res));
@GDmac GDmac changed the title SEGMENTATION FAULT when (accidentally) using array with keys SEGMENTATION FAULT when using array with keys Jul 27, 2023
@v-makouz
Copy link
Contributor

I can reproduce this, and will investigate further.

@v-makouz
Copy link
Contributor

v-makouz commented Aug 4, 2023

We know where the error is, so now it's a matter of applying the fix.

@GDmac
Copy link
Author

GDmac commented Aug 5, 2023

can the fix be back-ported to 5.10 (5.10.1 ?) too - some of our projects will remain on old PHP 😬

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

2 participants