|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-01-19 01:03 UTC] subspace at wanadoo dot nl
[2004-01-19 12:21 UTC] sniper@php.net
[2004-02-06 11:35 UTC] sniper@php.net
[2004-02-06 13:44 UTC] subspace at wanadoo dot nl
[2004-02-21 05:45 UTC] egarcia at egm dot as
[2004-02-25 14:53 UTC] fmk@php.net
[2004-10-18 20:39 UTC] freddyz77 at tin dot it
[2005-11-18 19:58 UTC] fmk@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 21:00:02 2025 UTC |
Description: ------------ Fields that have the SQL type 'bit' and are nullable return string(1) "0" for both 0 (false) and NULL values, when using mssql_fetch_row and similar. Expected behavior would be to return bool(false) for NULL values. Reproduce code: --------------- function vdump($value) { ob_start(); var_dump($value); $result = ob_get_contents(); ob_end_clean(); return trim($result); } $db = mssql_connect('servername', 'username', 'password'); mssql_query("CREATE TABLE #demo (bitfield BIT NULL, tinyfield TINYINT NULL)", $db); mssql_query("INSERT INTO #demo (bitfield,tinyfield) VALUES (0, 0)", $db); mssql_query("INSERT INTO #demo (bitfield,tinyfield) VALUES (1, 1)", $db); mssql_query("INSERT INTO #demo (bitfield,tinyfield) VALUES (NULL, NULL)", $db); $result = mssql_query("SELECT * FROM #demo", $db); while ($row = mssql_fetch_row($result)) echo "bit: " . vdump($row[0]) . "\t tiny: " . vdump($row[1]) . "\n"; mssql_query("DROP TABLE #demo", $db); Expected result: ---------------- bit: string(1) "0" tiny: string(1) "0" bit: string(1) "1" tiny: string(1) "1" bit: bool(false) tiny: bool(false) Actual result: -------------- bit: string(1) "0" tiny: string(1) "0" bit: string(1) "1" tiny: string(1) "1" bit: string(1) "0" tiny: bool(false)