|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15265 printing of mssql 'bit' value crashes script
Submitted: 2002-01-28 20:15 UTC Modified: 2002-10-09 11:56 UTC
From: shawn at wnsi dot net Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.1.1 OS: Linux 2.4.2-2smp Redhat7.1
Private report: No CVE-ID: None
 [2002-01-28 20:15 UTC] shawn at wnsi dot net
outputing a bit field via print, echo, or var_dump causes the process to go defunct.

--setup info
Apache/1.3.14 Ben-SSL/1.42
php 4.1.1
./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --enable-ftp --with-sybase=/usr/local/freetds --with-openssl=/usr/local/ssl --with-curl
mssql server 7.0

Here is an example
$bit_result = mssql_query('SELECT some_bit_field FROM fake_table');

$bit_row = mssql_fetch_array($bit_result);

print $bit_row['some_bit_field'];
--script crashes and the apache process goes defunct

This SQL cast fixes it....

$bit_result = mssql_query('SELECT Cast(some_bit_field AS varchar(2)) AS some_bit_field FROM fake_table');

$bit_row = mssql_fetch_array($bit_result);

print $bit_row['some_bit_field'];

The actual script that led me to discover this problem was sigificantly longer and I was able to use the value as long as I never ouput it (I think the reslts of comparisons I made were false though. i.e. if ( $bit_row['some_bit_field'] == 1 ) {} ). The point is that you can include the value in the expression but never ouput it.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-09 11:47 UTC]
Please try using this CVS snapshot:
For Windows:

 [2002-10-09 11:56 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

Please try a newer version of freetds.

I tested it with freetds-0.53 and 0.60 and both works for me fine without any crash.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 21:01:28 2024 UTC