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

Fetching binary data with binary encoding caused assertion in Linux #226

Closed
yitam opened this issue Jan 12, 2017 · 1 comment
Closed

Fetching binary data with binary encoding caused assertion in Linux #226

yitam opened this issue Jan 12, 2017 · 1 comment

Comments

@yitam
Copy link
Contributor

yitam commented Jan 12, 2017

Using the pdo_sqlsrv driver, when fetching some data from a binary column using the binary encoding, it caused assertion in Linux (tested in Ubuntu 16.04 for both PHP 7.0.x and PHP 7.1.0).

This is the repro script:

	$inValue1 = "zăǽβ񏳿"; 
	$mspdo1 = new PDO("sqlsrv:Server=$server;Database=$database;TraceOn=false", $uid, $pwd);	
	$stmt = $mspdo1->query("CREATE TABLE [php_test_table_1] ([c1_int] int, [c2_binary] binary(15))");	
	$stmt = $mspdo1->prepare("INSERT INTO [php_test_table_1] (c1_int, c2_binary) VALUES (:var1, :var2)");	
	$stmt->setAttribute(constant('PDO::SQLSRV_ATTR_ENCODING'), PDO::SQLSRV_ENCODING_BINARY);	
	$stmt->bindParam(2, $inValue1);	
	$stmt->bindValue(1, 1);	
	$stmt->execute();	
	$stmt = $mspdo1->prepare("SELECT * FROM [php_test_table_1]");	
	$stmt->setAttribute(constant('PDO::SQLSRV_ATTR_ENCODING'), PDO::SQLSRV_ENCODING_BINARY);	
	$stmt->execute();	
	$row = $stmt->fetch();	
	$outValue1 = $row[1];	
	var_dump($outValue1);

Expected output:

string(15) "zăǽβ񏳿   "

Actual output:

php: .../php-sdk/php-7.1.0/pdo_sqlsrv/shared/localizationimpl.cpp:43: static int cp_iconv::GetIndex(UINT): Assertion `false' failed.
Aborted (core dumped)
@yitam
Copy link
Contributor Author

yitam commented Feb 1, 2017

Fixed by #251

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

No branches or pull requests

2 participants