|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-11-05 19:19 UTC] freetds228 at lewenberg dot com
Description:
------------
When running a simple SELECT select query against an MS SQL server, if the result set has a field with a non-NULL date, we are getting the following error (with --enable-debug flag on):
[Sat Nov 5 11:26:07 2005] Script: '/www-s/testfreetds.php'
---------------------------------------
/root/tmp/php-4.4.1/ext/mssql/php_mssql.c(191) : Block 0x093CA2E0 status:
/root/tmp/php-4.4.1/Zend/zend_variables.c(44) : Actual location
(location was relayed)
Beginning: OK (allocated on
/root/tmp/php-4.4.1/ext/mssql/php_mssql.c:904, 19 bytes)
End: Overflown (magic=0x31383A34 instead of 0x2A8FCC84)
At least 4 bytes overflown
---------------------------------------
The query returns only a single row and field (a date). Note that Perl running the same query using the same freetds libraries has no errors.
We have compiled 4.4.1 against freetds 0.63 using the --with-mssql option.
Reproduce code:
---------------
$db = mssql_connect('mssqlserver', 'user', 'secret') ;
$rs = mssql_query('SELECT DateLastModified FROM Table WHERE rid = 1', $db) ;
Expected result:
----------------
The date should be accessible in the result set.
Actual result:
--------------
[Sat Nov 5 11:26:07 2005] Script: '/www-s/testfreetds.php'
---------------------------------------
/root/tmp/php-4.4.1/ext/mssql/php_mssql.c(191) : Block 0x093CA2E0 status:
/root/tmp/php-4.4.1/Zend/zend_variables.c(44) : Actual location
(location was relayed)
Beginning: OK (allocated on
/root/tmp/php-4.4.1/ext/mssql/php_mssql.c:904, 19 bytes)
End: Overflown (magic=0x31383A34 instead of 0x2A8FCC84)
At least 4 bytes overflown
---------------------------------------
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 23:00:01 2025 UTC |
I downloaded the newest version of the snapshot and it compiled, but I am still getting this error: [Sun Nov 6 08:07:02 2005] Script: 'testfreetds.php' --------------------------------------- /root/tmp/php5-200511061330/Zend/zend_variables.h(35) : Block 0x09CC6D78 status: /root/tmp/php5-200511061330/Zend/zend_variables.c(36) : Actual location (locatio n was relayed) Beginning: OK (allocated on /root/tmp/php5-200511061330/ext/mssql/php_mssql .c:907, 19 bytes) End: Overflown (magic=0x2A8FCC00 instead of 0x2A8FCC84) 1 byte(s) overflown --------------------------------------- Maybe it is a problem with some low-level library on my system. Is there a way to tell which system call is dying?I changed the number of bytes to be allocated for some of the column types in line 889 in ext/mssql/php_mssql.c at the suggestion of a user on the freetds list (just to experiment); see below for the change. This made the problem go away. However, this begs the question: why are the memory amounts normally specified (10 and 14) failing to work? Maybe there is some library that is being called having to do with dates that is corrupted. switch (column_type) { case SQLDATETIM4 : res_length += 140; break; case SQLDATETIME : res_length += 100; break; case SQLMONEY : case SQLMONEY4 : case SQLMONEYN : case SQLDECIMAL : case SQLNUMERIC :