From: jr-phpbugs at cedric dot unob dot cz Operating system: linux (irrelevant) PHP version: 4.4.4 PHP Bug Type: MSSQL related Bug description: PHP + FreeTDS 0.64 crashes when TEXT field with empty string encountered
Description: ------------ PHP, compiled with --with-sybase-ct=/usr/localFreeTDS crashes with segmentation fault on SELECT from column of type TEXT with empty string value. Observed on PHP compiled with --with-sybase-ct=/path/to/freetds-0.64/prefix , against MSSQL server 2000 Affects FreeTDS 0.64 and 0.64.1 (with 'post64.patch.gz' applied). Has not been observed with FreeTDS 0.63. FreeTDS 0.64 alone (without PHP) is not affected. Possible bug in ext/sybase_ct/php_sybase_ct.c Reproduce code: --------------- in MSSQL Enterprise manager: CREATE TABLE [dbo].[TEST] ( [TEST_ID] [int] IDENTITY (1, 1) NOT NULL , [TEST_VALUE] [int] NOT NULL , [TEST_TEXT] [text] NULL ) insert into TEST (TEST_VALUE) values ('5'); insert into TEST (TEST_VALUE,TEST_TEXT) values ('6',''); in PHP script: ... $query="SELECT test_text FROM test WHERE test_id=2; $res=mssql_query($query,$db); Expected result: ---------------- Empty string. Actual result: -------------- PHP crashes with segmentation fault. CLI version: - crash with "segmentation fault" message libphp4.so version: - affected thread produces a line "[notice] child pid XXXXX exit signal Segmentation fault (11)" in Apache's error log. -- Edit bug report at http://bugs.php.net/?id=39134&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39134&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39134&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39134&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39134&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39134&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39134&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39134&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39134&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39134&r=support Expected behavior: http://bugs.php.net/fix.php?id=39134&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39134&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39134&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39134&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39134&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39134&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39134&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39134&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39134&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39134&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39134&r=mysqlcfg